PageRenderTime 40ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/bad/ext/standard/tests/array/compact_variation1.php

http://github.com/facebook/hiphop-php
PHP | 24 lines | 16 code | 0 blank | 8 comment | 0 complexity | b58c28e5455d48f5ab9d448aaf64451d 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
  1. <?php
  2. /* Prototype : proto array compact(mixed var_names [, mixed ...])
  3. * Description: Creates a hash containing variables and their values
  4. * Source code: ext/standard/array.c
  5. * Alias to functions:
  6. */
  7. /*
  8. * compact variations - arrays with references
  9. */
  10. echo "*** Testing compact() : usage variations - arrays containg references ***\n";
  11. $a = 1;
  12. $b = 2;
  13. $c = 3;
  14. $string = "c";
  15. $arr1 = array("a", &$arr1);
  16. $arr2 = array("a", array(array(array("b"))));
  17. $arr2[1][0][0][] = &$arr2;
  18. $arr2[1][0][0][] = &$arr2[1];
  19. $arr3 = array(&$string);
  20. var_dump(compact($arr1));
  21. var_dump(compact($arr2));
  22. var_dump(compact($arr3));
  23. echo "Done";
  24. ?>