Guest User

Untitled

a guest
May 22nd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. fredemmott-pro:~ fredemmott$ cat test.php
  2. <?php
  3.  
  4. $a = [123, 456];
  5. foreach ($a as &$item);
  6. $b = array_combine($a, $a);
  7. var_dump($a);
  8. var_dump($b);
  9. fredemmott-pro:~ fredemmott$ php test.php
  10. array(2) {
  11. [0]=>
  12. int(123)
  13. [1]=>
  14. &int(456)
  15. }
  16. array(2) {
  17. [123]=>
  18. int(123)
  19. [456]=>
  20. &int(456)
  21. }
  22. fredemmott-pro:~ fredemmott$ hhvm test.php
  23.  
  24. Warning: Invalid operand type was used: Invalid type used as key in /Users/fredemmott/test.php on line 5
  25.  
  26. Warning: Invalid operand type was used: Invalid type used as key in /Users/fredemmott/test.php on line 5
  27. array(2) {
  28. [0]=>
  29. int(123)
  30. [1]=>
  31. &int(456)
  32. }
  33. array(0) {
  34. }
Add Comment
Please, Sign In to add comment