/hphp/test/zend/good/ext/standard/tests/array/compact_variation2.php

http://github.com/facebook/hiphop-php · PHP · 22 lines · 13 code · 4 blank · 5 comment · 0 complexity · 2b4458beb5184681b8d95344c6f308b6 MD5 · raw file

  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. echo "*** Testing compact() : usage variations - variables outside of current scope ***\n";
  8. $a = 'main.a';
  9. $b = 'main.b';
  10. function f() {
  11. $b = 'f.b';
  12. $c = 'f.c';
  13. var_dump(compact('a','b','c'));
  14. var_dump(compact(array('a','b','c')));
  15. }
  16. f();
  17. ?>
  18. ==Done==