11-08-2007, 09:51 AM
|
#7 (permalink)
|
|
Super Moderator
Join Date: Sep 2007
Posts: 165
Thanks: 0
|
Tanax, while that is correct it is not the cleanest approach to doing that.
PHP Code:
// Loops through the array, where $c is the value of the current element foreach($b as $c) {
if($c == $a) { break; }
// Optional, if the current element was NOT a match to the $a value
}
The above just breaks the loop after its found once, muchos cleaner, if you didn't want to break the loop, you could use "continue;" instead and have it skip the rest of the document that way and go through the next element in the array.
|
|
|
|