3v4l.org

run code in 300+ PHP versions simultaneously
<?php $john = array("goodie"); function test(){ global $john; for($i=0; $i<100; $i++) { array_push($john, "pro"); } print_r($john); } test(); // outputs correct array: array("goodie","pro","pro"....) /* then when again function is called */ test(); // output is NULL // with 100 errors in loop: // expects parameter 1 to be an array, NULL given...

preferences:
35.98 ms | 402 KiB | 5 Q