hiphop-php /hphp/test/quick/UnsetM.php

Language PHP Lines 33
MD5 Hash 15fc3f7bd4532f46db0532a4d9f42197 Estimated Cost $538 (why?)
Repository git://github.com/facebook/hiphop-php.git View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php

function main() {
  global $a;

  $a = array();
  $a[0] = 10;
  $a[1] = 11;
  $a["hi"] = "HI";
  $a["bye"] = "BYE";
  unset($a[1]);
  unset($a["hi"]);
  var_dump($a);

  // Try out G bases as well.
  $idxDefined = "foo";
  $idxNotDefined = "-- )) \\";
  $a[$idxDefined] = 071177;
  var_dump($a);
  unset($GLOBALS['a'][$idxDefined]);
  unset($GLOBALS['a'][$idxNotDefined]);
  var_dump($a);

  // Regression test for a translator bug
  $k = strtolower('blah');  // make it a dynamic string
  $s = array($k => 123);
  unset($s[$k]);
  unset($s[$k]);  // should have no effect
  var_dump($s);
}

main();
Back to Top