"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
is exactly what I needed! You did say it was untested, but I should add–for others searching for a similar answer–that the first parameter, '$a', only works without the single quotes.
andre4s_y, thank you as well for:
$arr2 = array_filter($arr,"tester");
The way you broke it down with the separate callback function helped me understand how the array_filter function worked. However, since I'm using it within a class, I couldn't figure out how to use the callback function within the class. For instance:
$arr2 = array_filter($arr, $this->"tester");
or
$arr2 = array_filter($arr, "$this->tester");
didn't work. This is an issue that I've had with callback functions before. Do you (or anyone else) know how to use this inside of a class?
Aha! THanks, In the past, I've looked for it on PHP.net, did google searches and have even posted threads here on that. Don't know why I always came up short of the answer. Thanks for your response!
Well, NogDog... you were right. You do need the single quotes around the $a. When I didn't include it, I mistakenly thought it worked because it returned all rows.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Bookmarks