Why is the above code showing error as follows:PHP Code:<?php
$myarray = array(
[0] => 'string a',
[2] => 'string b',
[4] => 'string c',
[8] => 'string d',
);
$arraycount = count( $myarray );
for( $i = 0; $i < $arraycount; $i++ ) {
echo 'key is: ' . $i . ' - value is ' . $myarray[$i] . '<br />';
}
?>
Parse error: syntax error, unexpected '[', expecting ')' in ....\xampp\htdocs\....\1.php on line 3



Reply With Quote


Bookmarks