Basic Variables
PHP Code:
<?php
$hello="Hello people,";
$php="this is my first PHP script.";
$php2="FTW!";
echo $hello." ".$php." ".$php2;
?> Outputs….
Quote:
| Hello people, this is my first PHP script. FTW! I could of used just one variable, for example…. |
PHP Code:
<?php
$text="Hello people, his is my first PHP script. FTW!";
echo $text;
?> But I wanted to use multi variables ftw. Learn how to join them and put spaces between then and shiz.
The . is used to join two comands/variable outputs, like this.
PHP Code:
<?php
$hello="Hello people,";
$php="this is my first PHP script.";
$php2="FTW!";
echo $hello.$php.$php2;
?> That would output…
Quote:
| Hello people,this is my first PHP script.FTW! See, there is no spaces in between the variables. So we want to add spaces yea? Yea ftw. So we use ” ” to add spaces between the variables. But we also want to join the variables after the space so we use . ” ” . between the variables like this. |
PHP Code:
<?php
$hello="Hello people,";
$php="this is my first PHP script.";
$php2="FTW!";
echo $hello. " " .$php. " " .$php2;
?> 