Folks,
I know I could do this with a foreach loop but it looks dirty. I'm
wondering if I can do this via array_walk() or asort() and would appreciate
some help..
I have an array - an example follows
$tmpArray[0]="one";
$tmpArray[1]="two";
$tmpArray[2]="three";
$tmpArray[3]="apples";
$tmpArray[4]="ref=1";
The elements can be written up in any order, thus the last element "ref=1"
could have been anywhere in the array, its just for this example that I have
placed it as the last element.
I need to read these elements, but I need to give precedence to first
reading the elements that contain an equals sign before the others... It
does *not* have to be alphabetically sorted - so the following result would
be acceptable:
$tmpArray[0]="ref=1";
$tmpArray[1]="one";
$tmpArray[2]="two";
$tmpArray[3]="three";
$tmpArray[4]="apples";
Can anyone suggest/tell me a method that might be environmentally friendly
to do this? I think array_walk might help but I've never worked out how to
use it...
Thanks
randelld
Comment