array; if empty set to the first one
Posted: Tue Mar 30, 2004 3:59 pm
hi
I haven't found anything about this topic, so I would like to ask here:
If an element of an array is empty, I would like to set that array to the first element.
What I mean is:
$array = array(
"red" => "car",
"blue" => "bike",
"white" => "",
)
so if "white" is empty I want to set it to the first one.
print $array['white'] ; // output : car
Thank you
anotherJean
I haven't found anything about this topic, so I would like to ask here:
If an element of an array is empty, I would like to set that array to the first element.
What I mean is:
$array = array(
"red" => "car",
"blue" => "bike",
"white" => "",
)
so if "white" is empty I want to set it to the first one.
print $array['white'] ; // output : car
Thank you
anotherJean