I'm trying to create the php array of hrefs links.
However when Im running the page im getting error message:
Undefined offset: 0
And I would like to know how to fix this, or is there any other way how to put "hrefs" into array.
Array code:
<?php
$links = array (
"a" => "<a href='variabletypes.php'>link</a>",
"b" => "<a href='variabletypes.php'>link</a>",``
"c" => "<a href='variabletypes.php'>link</a>",;
"d" => "<a href='variabletypes.php'>link</a>",;
"e" => "<a href='variabletypes.php'>link</a>",
);
for($i=0; $i<sizeof($links);$i++)``
echo $links[$i];
?>;
a,b,c, but you try to access the array with numeric keys e.g.0,1,2,3, so this is obviously not going to work. So I would recommend you to use a foreach loop, you can read more about it in the manual: php.net/manual/en/control-structures.foreach.php