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>

Recommended Answers

All 2 Replies

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')
Member Avatar for diafol

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 />';
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.