Saturday, May 28, 2011

PHP Variables

PHP is a weakly typed language, so data types aren't a big deal. The hardest part is escaping strings, which is super simple. Here is a plain string variable, all variables always start with a dollar sign.
<?php
$my_string = "Hello World";
echo $my_string;
?>
 Here are some other ways to use and store data in variables.

<?php
$my_string = "Hello World";
$my_num = 122;
$my_string .= ", how are you";

echo $my_string;
?>

No comments:

Post a Comment