Warning when using Array_Push
Posted: Fri Aug 22, 2008 11:57 am
Hey guys,
Well, I googled this a bit, and I understand what normally would cause this warning--but I don't see how it applies in my situation. Here's my code:
I get this warning:
The code works, perfectly. Just that the output of this warning is screwing up the Header--and I want to know how I can do this without PHP thinking it's a mistake.
First off, I am certain that $post is an array. I was trying to push a random value to it, with with the key of "random". Why is this giving me this error, when the first argument is an array?
Thanks.
Well, I googled this a bit, and I understand what normally would cause this warning--but I don't see how it applies in my situation. Here's my code:
Code: Select all
$random = rand();
array_push($post['random'],$random);
$post['random'] = $random;Code: Select all
Warning: array_push() [function.array-push]: First argument should be an array...First off, I am certain that $post is an array. I was trying to push a random value to it, with with the key of "random". Why is this giving me this error, when the first argument is an array?
Thanks.