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.

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

Should produce the following output

[box] Variables

This Ford Explorer is a 2003

[/box]

Leave a Reply