[thelist] PHP - array manipulation

John Corry webshot at members.evolt.org
Fri May 10 15:49:00 CDT 2002


> - I want to remove $array['month'], $array['day'], and $array['year'].
> - Then I want to turn them into
> "$array['year']-$array['month']-$array['day']".
> - Then I want to return that new value to the array as $array['date'].


This must be too simple to actually work...

// set the date
$array['date'] = "$array['year']-$array['month']-$array['day']";

// I would just leave the other 3 array key=>value pairs and simply not
refer to them anymore
// if you're a clean freak though
Unset($array['year'];
Unset($array['month'];
Unset($array['day'];

Uh...looks obvious..so I'm suspicious that there's prolly somewthin'
wrong with that approach.

jpc




More information about the thelist mailing list