/hphp/test/quick/UnsetM.php
PHP | 30 lines | 25 code | 3 blank | 2 comment | 0 complexity | acf6219c85bde3e60ace54de191a8dbb 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
- <<__EntryPoint>>
- function main() {
- $a = darray[];
- $a[0] = 10;
- $a[1] = 11;
- $a["hi"] = "HI";
- $a["bye"] = "BYE";
- unset($a[1]);
- unset($a["hi"]);
- var_dump($a);
- $GLOBALS['a'] = $a;
- // Try out G bases
- $idxDefined = "foo";
- $idxNotDefined = "-- )) \\";
- $GLOBALS['a'][$idxDefined] = 071177;
- var_dump($GLOBALS['a']);
- unset($GLOBALS['a'][$idxDefined]);
- unset($GLOBALS['a'][$idxNotDefined]);
- var_dump($GLOBALS['a']);
- // Regression test for a translator bug
- $k = strtolower('blah'); // make it a dynamic string
- $s = darray[$k => 123];
- unset($s[$k]);
- unset($s[$k]); // should have no effect
- var_dump($s);
- }