I am getting an error saying
Parse error: syntax error, unexpected '[' in /home/ajayi/public_html/html/arrays.php on line 14
When I added the sort is when I started getting the error. What I am trying to do is have the names of the fruits sorted in alphabetical order.
this is my code...
$myArray = array('0' => 'tangerine' , '1' => 'orange' , '2' => 'kiwi', '3' => 'strawberry' , '4' => 'banana', '5' => 'grape', '6' => 'pear' , '7'=> 'apple');
echo "<table border ='2px black solid'>";
for ($x = 0; $x < 8; $x++){
echo "<tr>";
for($y = 0; $y < 10; $y++){
echo "<td>".sort($myArray)[$x][$y]."</td>";
}
echo "</tr>";
}
echo"</table>";