search
top

Variables – Bad Form

This is a small example of the ‘bad’ form of variable naming.  What’s bad about it is the fact when you read the code:   echo “This $a $b is a $c <br>“;  it is all but impossible to guess which variable is which.  Contrast this with the ‘good form’ variables, which is much easier to read.

<html>
<body>
<h1>Variables</h1>
<?php
 echo "<br>";
 $a="Ford";
 $b="Explorer";
 $c = 2003;
 echo "This $a $b is a $c <br>";
?>
</body>
</html>

Should produce the following output

Variables

This Ford Explorer is a 2003

Leave a Reply

top