A PHP script is executed on the server and the plain HTML response returned by server to the web browser.
The PHP echo and print statement is used to output data to the screen.
PHP script starts with and ends with ?> for example-
My first PHP page
echo "Welcome to the world of php script";
echo "It is php short open tag example.";
HTML script tags:
A comment in PHP code is a line that is not interpreted as part of the program by PHP interpreter. Comments are added with the purpose of making the source code easier for programmer to understand, and are generally ignored by compilers and interpreters.
Why we use comment in programming?
Let others understand what you are doing:
PHP supports different type of commenting such as single line comment and multiline comment for example-
// This is a single-line comment
# This is also a single-line comment
This is a multiple-lines comment block
that spans over multiple
// You can also use comments to leave out parts of a code line
$x = 5 /* + 15 */ + 5;
Keywords in PHP such as if ,else , echo ,while etc are not case sensitive. but classes, functions, and user-defined functions are case-sensitive. The following all the three echo statements are valid in PHP.
ECHO "Welcome to the world of php script!
echo "Welcome to the world of php script!
EcHo "Welcome to the world of php script!
$msg = "PHP variables are case-sensitive.";
echo $msg ;
echo $Msg; // $Msg print nothing