I need assistance in creating a new array from the following array:
Array (
[Diesel] => Diesel
[691.400000572205] => 691.400000572205
[Off-Road Diesel] => Off-Road Diesel
[1104.20000505447] => 1104.20000505447 )
I need to new array to look like this:
Array (
[Diesel] => 691.400000572205
[Off-Road Diesel] => 1104.20000505447 )
What's the best way to go about this?
Thanks!
PHP Array Help
Moderator: General Moderators
Re: PHP Array Help
Code: Select all
for ($i = 0; $i < count($array); $i += 2)
{
$new_array[$array[$i]] = $array[$i + 1];
}