PHP: Hypertext preprocessor.
Basic Syntax:
<?php
// php code;
?>
The php script starts with <? and ends with ?>. These tags are called Canonical php tags.
Ex: Hello world example
Variables:
Ex: $name, $Nane are different.
Syntax: $variable_name value;
Variables are classified into three types
1. Local:
A variables which is declared inside of a function is considered as local.
Its scope is inside of that function only.
2.Global:
Global variables are declared outside of the function.
Its scope is within entire program.
To access global variables inside the function we have to use global keyword.
3. Static:
When ever the function completes its execution, all of its variables are deleted.
If we want local variables values not to delete, then we can use static keyword not to delete the values.
- It is a server side scripting language.
- It is designed specially for web development.
- It is easily embedded in html files and html code can be written in a php file.
- PHP codes are executed on server and html codes are rendered on browser.
- It's codes are first executed on the server and then the result is returned to the browser.
- In php class, functions, user defined functions and keywords are not case-sensitive.but variable names are case sensitive.
Basic Syntax:
<?php
// php code;
?>
The php script starts with <? and ends with ?>. These tags are called Canonical php tags.
Ex: Hello world example
Variables:
- A Variable is nothing but a field which is used to hold the data.
- In php variable start with $ sign, followed by name of the variable.
- A variable name start with a letter or the underscore character.
- A variable name cannot start with a number.
- Variable name are case-sensitive.
Ex: $name, $Nane are different.
Syntax: $variable_name value;
Variables are classified into three types
1. Local:
A variables which is declared inside of a function is considered as local.
Its scope is inside of that function only.
2.Global:
Global variables are declared outside of the function.
Its scope is within entire program.
To access global variables inside the function we have to use global keyword.
3. Static:
When ever the function completes its execution, all of its variables are deleted.
If we want local variables values not to delete, then we can use static keyword not to delete the values.