PHP Variable Syntax

PHP is a dynamically typed language. What this means is that you do not have to specify the variable type. You do not even need to declare you variable before using it. All variables have a $ in front of them and cannot be more than 64 characters long. String variables require that the value be surrounded by double or single quotes. Numerical values do not need to surrounded by quotes, but they can be if you so desire. They will still be recognized as numerical (PHP is nice that way).

For example, here are some basic variable declarations:

<?
$address = "123 Somewhere"; $zip = 49123
?>

Leave a Reply

Your email address will not be published. Required fields are marked *