Jump to content

[SOLVED] Silly PHP error


geekette

Recommended Posts

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

<!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 :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.