- array_push: documentation ( source)
- print_r: documentation ( source)
<?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...