Before going to start project with PHP you should have a basic knowledge about
Without knowing the basic knowledge you may face problem during Project work.
A PHP script starts with <?php and ends with ?>.
<?php
// write your PHP code here
?>
The file extension for PHP files is ".php".
A PHP file contains PHP scripting code, HTML tags, css and JavaScript.
Below, we have an example of a simple PHP file.
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP Script</h1>
<?php
echo "Hello World!";
? >
</body>
</html>
Note:
PHP statements end with a semicolon (;).
There are various way of commenting PHP
<!DOCTYPE html>
<html>
<body>
<?php
// This is a single-line comment
# This is also a single-line comment
/*
This is a multiple-lines comment
*/
? >
</body>
</html>
In PHP, all keywords (e.g. if, else, while, echo, etc.), classes, functions, and user-defined functions are NOT case-sensitive.
<!DOCTYPE html>
<html>
<body>
<?php
ECHO "Hello World! <br>";
eCHO "Hello World! <br>";
echo "Hello World! <br>";
EcHo "Hello World! <br>";
? >
</body>
</html>
But in PHP all variable names are case-sensitive.
<!DOCTYPE html>
<html>
<body>
<?php
$colour = "green";
echo "My house colour is " . $colour . "<br>";
echo "My pen colour is " . $COLOUR . "<br>";
echo "My shirt colour is" . $coLOUR . "<br>";
? >
</body>
</html>