Coder1
Aricles and Screencasts by Mike Milano
Today is: 21 November, 2008
Check todays hot topics or new pictures
Aricles and Screencasts by Mike Milano
Today is: 21 November, 2008
Check todays hot topics or new pictures
PHP foreach value by reference
The best way to demonstrate this is to establish an objective. There's at least 3 general ways we could go about this but obviously I'd like to show you how this can be accomplished using foreach with the value of each iteration as a reference.
Notice we did not need to access the original array with a key to change the values inside of it. i.e. $array[0] = strtoupper($array[0]); Remember that this will not work in PHP4 so don't use it if your code needs to be backwards compatible. |
|||
|
Copyright © 2008, Mike Milano
|
Post new comment