geekette Posted March 4, 2009 Share Posted March 4, 2009 Here's what I wrote out: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Central Valley Civic Center</title> </head> <body> <h1>Central Valley Civic Center</h1> <h2>Summer Concert Season</h2> <?php $Concerts = array ("Jimmy Buffet", "Chris Isaak", "Bonnie Raitt", "James Taylor", "Alicia Keys" ); $Concerts [ ] = "Bob Dylan" ; $Concerts [ ] = "Ryan Cabrera" ; $Concerts[2] = "Joe Cocker" ; $Concerts[3] = "Van Morrison" ; echo "<p>The following ", count($Concerts), " concerts are scheduled:</p><p>" ; echo "$Concerts [0] <br />"; echo "$Concerts [1] <br />"; echo "$Concerts [2] <br />"; echo "$Concerts [3] <br />"; echo "$Concerts [4] <br />"; echo "$Concerts [5] <br />"; echo "$Concerts [6] </p>"; ?> </body> </html> And here's what I'm seeing in my browser: Central Valley Civic Center Summer Concert Season The following 7 concerts are scheduled: Array [0] Array [1] Array [2] Array [3] Array [4] Array [5] Array [6] Clearly, there's a bit of a discrepancy. Any help would definitely be appreciated! Link to comment https://forums.phpfreaks.com/topic/147883-solved-silly-php-error/ Share on other sites More sharing options...
jrws Posted March 4, 2009 Share Posted March 4, 2009 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Central Valley Civic Center</title> </head> <body> <h1>Central Valley Civic Center</h1> <h2>Summer Concert Season</h2> <?php $Concerts = array ("Jimmy Buffet", "Chris Isaak", "Bonnie Raitt", "James Taylor", "Alicia Keys" ); $Concerts [ ] = "Bob Dylan" ; $Concerts [ ] = "Ryan Cabrera" ; $Concerts[2] = "Joe Cocker" ; $Concerts[3] = "Van Morrison" ; echo "<p>The following ", count($Concerts), " concerts are scheduled:</p><p>" ; echo "$Concerts[0] <br />"; echo "$Concerts[1] <br />"; echo "$Concerts[2] <br />"; echo "$Concerts[3] <br />"; echo "$Concerts[4] <br />"; echo "$Concerts[5] <br />"; echo "$Concerts[6] </p>"; ?> </body> </html> Note no space I hope this is what you wanted Link to comment https://forums.phpfreaks.com/topic/147883-solved-silly-php-error/#findComment-776171 Share on other sites More sharing options...
Yesideez Posted March 4, 2009 Share Posted March 4, 2009 Remove the spaces between $concerts and the index value. Eg. $Concerts[6] and not $Concerts [6] Link to comment https://forums.phpfreaks.com/topic/147883-solved-silly-php-error/#findComment-776176 Share on other sites More sharing options...
geekette Posted March 4, 2009 Author Share Posted March 4, 2009 Niice! That worked! Thanks Yesideez and jrws! Link to comment https://forums.phpfreaks.com/topic/147883-solved-silly-php-error/#findComment-776203 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.