PHP Essentials
Learn PHP quick! Here are the php elements and functions which I find essential in developing applications with PHP.
Basic Syntax
<?php echo “hello world”; ?> |
The output would be:
hello world |
Variables
Variables are represented by a dollar sign ($) and does not require type declaration.
<?php $a = “this is a string”; $b = 1; $c = 2; $d = $b + $c; echo $d . ” is an integer” . “<br>”; echo $a; ?> |
The output would be:
3 is an integer
this is a string |
Basic Conditions
Here are some of the most basic conditions:
<?php $a = 1; $b = 2; if($a==$b){ echo “a is equal to b” . “<br>”; } else if($a!=$b){ echo “a is not equal to b” . “<br>”; } if($a>=$b) or $a==1){ echo “a is greater than or equal to b or a is equal to 1”; } ?> |
The output would be:
a is not equal to be a is greater than or equal to b or a is equal to 1 |
….Anyway, this is supposed to be a reference, not a tutorial. To really learn php, go to this site!
Leave a Reply