Why am I getting this error message "Warning: array_push() expects parameter 1 to be array, null given ..." When I removed the function and just run the for loop, it works, but not inside function. why?
<?php
$arr = array();
function callme() {
for ($x = 1; $x <= 10; $x++) {
array_push($arr, $x);
}
return $arr;
}
callme();
print_r($arr);
?>