/hphp/test/slow/simple_xml/isset.php

http://github.com/facebook/hiphop-php · PHP · 20 lines · 18 code · 2 blank · 0 comment · 2 complexity · c34fb292329fd8a349b6eb2966f01cf6 MD5 · raw file

  1. <?hh
  2. function test_isset($str) {
  3. $xml = '<field Default="' . $str . '"/>';
  4. $field = new SimpleXmlElement($xml);
  5. var_dump(isset($field));
  6. var_dump($field->offsetExists('Default') && $field->offsetGet('Default') !== null);
  7. var_dump($field->offsetExists('XXX') && $field->offsetGet('XXX') !== null);
  8. }
  9. <<__EntryPoint>>
  10. function main_isset() {
  11. test_isset("");
  12. test_isset("No");
  13. test_isset("Yes");
  14. test_isset("NULL");
  15. test_isset("0");
  16. test_isset("1");
  17. test_isset("20");
  18. }