Howdie do,
I have one multidimensional associative array of server types. This array contains a sub array of values.
It's easier to see:
$servers = array('Dell R410 Dual Xeon X5650 Hexacore 2.66 GHz' => array('Model' =>$R410Model, 'Description' =>$R410Desc,'Counter' => $R410HexCoreE5650Count));
I want to add additional server type associative array. This is what I've done:
$servers[] = array('Atoms D510 1.66Ghz' => array('Model' =>$AtomModel, 'Description' =>$AtomDesc,'Counter' => $AtomCount));
$servers[] = array('Celerons 2.40Ghz' => array('Model' =>$CeleronModel, 'Description' =>$CeleronDesc,'Counter' => $CELERONCount));
It does add the value, but it does it by index and not the actual server type key.
Array ( [Dell R410 Dual Xeon X5650 Hexacore 2.66 GHz] => Array ( [Model] => DELL R410 [Description] => Dual Xeon X5650 Hexacore 2.66 GHz [Counter] => 25 )
[0] => Array ( [Atoms D510 1.66Ghz] => Array ( [Model] => ATOM [Description] => D510 1.66Ghz [Counter] => 1 ) )
[1] => Array ( [Celerons 2.40Ghz] => Array ( [Model] => [Description] => [Counter] => 0 ) ) )
How do I move the sub arrays up one so that it adds them by key and not index. So that it looks like this
Array ( [Dell R410 Dual Xeon X5650 Hexacore 2.66 GHz] => Array ( [Model] => DELL R410 [Description] => Dual Xeon X5650 Hexacore 2.66 GHz [Counter] => 25 )
Array ( [Atoms D510 1.66Ghz] => Array ( [Model] => ATOM [Description] => D510 1.66Ghz [Counter] => 1 ) )
Array ( [Celerons 2.40Ghz] => Array ( [Model] => [Description] => [Counter] => 0 ) ) )
$servers[SERVER_NAME] = array(WITH THE DATA IN IT)
:) – Darren Oct 8 '14 at 0:28