Nick Davies wrote:
> Why does this work :
>
> $categorySplit = split(",", $row['category']);
>
> while (list($key, $value) = each ( $categorySplit )) {
> $categoryArray["$value"] = 1;
> }
>
> But this not :
>
> while (list($key, $value) = each ( split(",", $row['category']) )) {
> $categoryArray["$value"] = 1;
> }
>
> I keep getting "Maximum execution time of 30 seconds exceeded" errors.

$categorySplit contains an array, while split(",", $row['category']) creates
a new array.

In your second example, you are creating a new array every time that the
while loop runs. This makes the loop condition always true, so the loop runs
til PHP exceeds the max allowed run time.

--zak


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to