array and for clarification.
From: Brian ((_at_))
Date: 10/31/03
- Next message: gmcclary: "Re: wysiwyg page creator with FTP upload?"
- Previous message: Randell D.: "Re: To register_globalsl=On or Not to register_globals=On"
- Next in thread: Justin Koivisto: "Re: array and for clarification."
- Reply: Justin Koivisto: "Re: array and for clarification."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 31 Oct 2003 06:13:51 GMT
I'm diddlying with a script, and found some behavior I don't understand.
Take this snippet:
for ($i = 0; $i <= count($m); $i++) {
array_shift($m[$i]);
reset($m);
}
This doesn't work, it says:
Warning: array_shift(): The argument should be an array in ./tool.php on
line 31
However, this does work:
$c = count($m);
for ($i = 0; $i <= $c; $i++) {
array_shift($m[$i]);
}
Why can't I reference the count of $m in the for without it crapping out,
but if I make a variable it is fine? $m doesn't change, so even if it
recounted $m each time, it would be the same.. I'd think.
Many thanks.
--Brian
- Next message: gmcclary: "Re: wysiwyg page creator with FTP upload?"
- Previous message: Randell D.: "Re: To register_globalsl=On or Not to register_globals=On"
- Next in thread: Justin Koivisto: "Re: array and for clarification."
- Reply: Justin Koivisto: "Re: array and for clarification."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|