0

I need some help on why I cant get these numbers to show from the array when i Run it

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type"
	  content="text/html; charset=iso-8859-1" />
<meta name="author" content="Revised by josephr10"/>
</head>
<body>
<?php 

$RatesArray = array(.0525;,.0550;, .0575;, .0600;, .0635;, .0650;, .0675;)

echo "<p> The interest rates are:</p><br />"

echo $RatesArray[0]<br />;
echo $RatesArray[1]<br />;
echo $RatesArray[2]<br />;
echo $RatesArray[3]<br />;
echo $RatesArray[4]<br />;
echo $RatesArray[5]<br />;
echo $RatesArray[6]<br />;
?>
</body>
</html>
3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by diafol
0

Why have you got semi-colons after each number? Unless that is what you want to display then they are not required. Due to the full stops I would also say you need to contain each array value in ' ' or " " as they become strings. For example

$RatesArray = array('.0525','.0550','.0575','.0600','.0635','.0650','.0675')
0

and instead of all those echoes:

echo $RatesArray[0]<br />;
echo $RatesArray[1]<br />;
echo $RatesArray[2]<br />;
echo $RatesArray[3]<br />;
echo $RatesArray[4]<br />;
echo $RatesArray[5]<br />;
echo $RatesArray[6]<br />;

do this:

foreach($RatesArray as $r){
  echo $r . '<br />';
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.