This is my code, and when I run this function I get this :Warning: array_push() expects parameter 1 to be array However I define $printed as an array
Warning: array_push() expects parameter 1 to be array
$printed
You need to use global $printed; or to add $printed as a function parameter.
global $printed;
You may also pass the $printed parameter as reference in your function: http://php.net/manual/en/language.references.pass.php
More about global and variable scopes: http://php.net/manual/en/language.variables.scope.php