I am new to PHP, willing to learn. I recently encountered an issue while completing an exercise. Here`s what I have to do:
I need to define, first, an multi-dimensional array witch contains the producer and the model of certain mobile phones
EG:
$model = array(
"manufacurer" => array ("model1", "model2", ...),
"manufacurer2" => "array( "model3", model4", ...),
);
Next task: Starting from the above array $model I have to generate another multi-dimensional array, let's call it $shop.
It should look like this:
$shop = array("model1"=>array("manufacurer"=> "manufacurer1",
"caractheristics" => array("lenght"=>...
"wide"=>...,
"weight"=>...)
),
"model2"=>array("manufacurer"=>...etc
Here's my code:
<?php
$modele = array(
"Nokia" => array ("3310", "n8", "1100"),
"Samsung" => array( "Galaxy S7", "Bean", "e220"),
"Sony" => array("Xperia", "K750", "W810")
);
print_r($modele);
// it has stored my values
echo "<br>";
$magazin = array(
'$model["Nokia"][0]' => array(
'manufacturer' => '$modele[2]'
// How do I use the values from the $model array to $shop array? If i print_r($model["Nokia"][0]) it returnes 3310, witch is ok, but when I print_r($magazin) it returns: Array ( [$modele["Nokia"][0]] => Array ( [producator] => $modele[2] ) )
)
);
print_r($magazin);
?>