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); assert ($prices[0] === 100); //false! pass-by-value $prices = [1, 2, 3]; modify_location($prices); echo ($prices[0] === 40); //false! pass-by-value
based on ZnCFD
Output for 7.0.0 - 7.2.0
Warning: assert(): assert($prices[0] === 100) failed in /in/IjQsi on line 13
Output for 5.4.2 - 5.6.28
Warning: assert(): Assertion failed in /in/IjQsi on line 13
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/IjQsi on line 8
Process exited with code 255.