3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function modify_in_place($prices) { $prices[0] = 100; } function modify_location($prices) { $prices = [40, 50, 60]; } $prices = [1, 2, 3]; modify_in_place($prices); echo (bool)($prices[0] == 100); //failed! pass-by-value $prices = [1, 2, 3]; modify_location($prices); assert($prices[0] == 40); //failed! pass-by-value
based on 4VSbK
Output for 7.0.0 - 7.2.0
Warning: assert(): assert($prices[0] == 40) failed in /in/VVKSm on line 17
Output for 5.4.8 - 5.6.28
Warning: assert(): Assertion failed in /in/VVKSm on line 17
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/VVKSm on line 8
Process exited with code 255.