/hphp/test/slow/simple_xml/isset.php
PHP | 20 lines | 18 code | 2 blank | 0 comment | 2 complexity | c34fb292329fd8a349b6eb2966f01cf6 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
- <?hh
- function test_isset($str) {
- $xml = '<field Default="' . $str . '"/>';
- $field = new SimpleXmlElement($xml);
- var_dump(isset($field));
- var_dump($field->offsetExists('Default') && $field->offsetGet('Default') !== null);
- var_dump($field->offsetExists('XXX') && $field->offsetGet('XXX') !== null);
- }
- <<__EntryPoint>>
- function main_isset() {
- test_isset("");
- test_isset("No");
- test_isset("Yes");
- test_isset("NULL");
- test_isset("0");
- test_isset("1");
- test_isset("20");
- }