Skip to content

Instantly share code, notes, and snippets.

@rurtubia
Last active November 6, 2015 00:03
Show Gist options
  • Save rurtubia/f219ed7b6c29ed4c7284 to your computer and use it in GitHub Desktop.
Save rurtubia/f219ed7b6c29ed4c7284 to your computer and use it in GitHub Desktop.
php Hello World
<!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>
<!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>
<!Doctype HTML>
<HTML>
<BODY>
<?php
echo "Hello World";
?>
</BODY>
</HTML>
<!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