Last active
November 6, 2015 00:03
-
-
Save rurtubia/f219ed7b6c29ed4c7284 to your computer and use it in GitHub Desktop.
php Hello World
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<HTML> | |
<BODY> | |
<?php | |
#in php, keywords, classes, functions and user-defined functions are Non-Case Sensitive: | |
ECHO "hi<br>"; | |
Echo "hi<br>"; | |
echo "hi<br>"; | |
#However, all variables are Case Sensitive: | |
$color = "red"; | |
$COLOR = "blue"; | |
$Color = "green"; | |
echo "My house is " . $color . ", your house is " . $COLOR . " and his house is " . $Color; | |
?> | |
</BODY> | |
</HTML> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!Doctype HTML> | |
<HTML> | |
<BODY> | |
<?php | |
echo "Hello World"; | |
// single line comment style 1 | |
# single line comment style 2 | |
/* | |
multi-line comment | |
*/ | |
$x = 5 + /*5 +*/ 5; //inline-comment. | |
?> | |
</BODY> | |
</HTML> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!Doctype HTML> | |
<HTML> | |
<BODY> | |
<?php | |
echo "Hello World"; | |
?> | |
</BODY> | |
</HTML> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<HTML> | |
<BODY> | |
<?php | |
function function1(){ | |
//Static variables can keep their value after execution. | |
static $x = 1; | |
echo $x; | |
echo "<br>"; | |
$x++; | |
} | |
function1(); | |
function1(); | |
function1(); | |
function1(); | |
function1(); | |
?> | |
</BODY> | |
</HTML> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment