I am new to php and trying to use map array. I would like my $arr2
to hold values of different types of fruits. But when I execute the following code, it tells me "apple"
is an undefined index. Can you please show me how can I correct the following code so that I can accesses different values?
<?php
main_fun ();
function main_fun ()
{
$arr2 = array();
num2_data ($arr2);
echo "<br>.".$arr2["apple"]["q1"]; // quadrant 1 value of apple
echo "<br>.".$arr2["orange"]["q2"]; // quadrant 2 value of orange
}
function num2_data (&$arr2)
{
$arr2 = array("apple" => array("q1" => 1.1380711874577, "q2" => 1.7625118400083, "q3" => 1.8957417329238, "q4" => 2.4453545524829));
$arr2 = array("orange" => array("q1" => 1.1380711874577, "q2" => 2.5045795667914, "q3" => 1.8957417329238, "q4" => 2.7192512120757));
}
?>