""kenny.hibs"" <[EMAIL PROTECTED]> wrote:
> My isp uses php3 and some of my scripts have the function 'foreach'
> which is php4.
> Is there are way to fix this

Sure.

If your code says:

foreach($array as $element) { // this is a numerically-indexed array
    ...
}

do:

while(list(,$element) = each($array)) { // the "," is important in
"list(,$element)".
    ...
}

If your code says:

foreach($array as $key => $value) { // real associative array
    ...
}

do:

while($list($key, $value) = each($array)) {
    ...
}

This way, all you have to change is the loop itself -- nothing inside the
loop needs to be changed if you do it this way.

Dean.



-- 
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