Warning: array_push() expects parameter 1 to be array

前端 未结 4 916
北海茫月
北海茫月 2021-02-06 06:17

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

4条回答
  •  失恋的感觉
    2021-02-06 06:44

    You need to use global $printed; or to add $printed as a function parameter.

    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

提交回复
热议问题