frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

PHP Examples

PHP Syntax

Write text to the output using php

<!DOCTYPE html>
<html>
<body>

<h1>My first PHP page</h1>

<?php
echo "Hello World!";
?> 

</body>
</html>

Keyword, class, functions, and user-defined functions ARE NOT case- senstive

<!DOCTYPE html>
<html>
<body>

<?php
ECHO "Hello World!<br>";
echo "Hello World!<br>";
EcHo "Hello World!<br>";
?> 

</body>
</html>

Veriable Name ARE case-senitive

<!DOCTYPE html>
<html>
<body>

<?php
$color = "red";
echo "My car is " . $color . "<br>";
echo "My house is " . $COLOR . "<br>";
echo "My boat is " . $coLOR . "<br>";
?> 

</body>
</html>

Syntax explained

PHP Comments

Syntax for single-line comments

<!DOCTYPE html>
<html>
<body>
 
<?php
// This is a single-line comment

# This is also a single-line comment
?>
 
</body>
</html>

Syntax for multi-line comments

<!DOCTYPE html>
<html>
<body>
 
<?php
/*
This is a multiple-lines comment block
that spans over multiple
lines
*/
?>
 
</body>
</html>

Using comments to leave out parts of the code

<!DOCTYPE html>
<html>
<body>
 
<?php
// You can also use comments to leave out parts of a code line
$x = 5 /* + 15 */ + 5;
echo $x;
?>
 
</body>
</html>


Tagged:
Sign In or Register to comment.

Developer

| make vanilla clean and light
@ 2016 Your Sitename, All rights reserved. Material Design is a design language developed by Google. Material Design makes more liberal use of grid-based layouts and responsive animations and transitions.
Powered by VanillaForums, Designed by ThemeSteam

Contact us

info@example.com
support@example.com
(800) 3032120

Get In Touch