Tags of PHP:
We mainly use 4 tags in PHP for any code and expressions.
They are
- Default tag or Standard tag
- Short tag
- Asp style tag
- Script tag
Default tag:
syntax:
Short tag:
syntax:
Asp tag:
syntax:
<% …........... %>
Script tag:
syntax:
Variable in PHP:
- Variables must be start with $ sign.
- Variables name first character must be alphabet.
- Variables in PHP follows alpha numeric concept.
- Variables are case sensitive.
- We can join one or more character or words as like as variable name through _(under score).
Ex:
int join_sal=100;
(or)
int joinSal=100;
- A space and special symbol not allow with variable name.
Variable must end with semicolon.
Ex:
int join_sal=100;
(or)
int joinSal=100;
Variable must end with semicolon.
Data type :
Data type is used to define while typing of values are specific in a variable.
There are six standard data types used in PHP.
- Integer (whole number, Ex : 54534)
- Float/Double (real number, Ex :1.677,24.786)
- String (any type of character which includes within single quotes. Ex : 'f',”regfd242”)
- Array (It can store one or more value in single memory space)
- Boolean (True or False statement)
- Object
In PHP we use two specific data types
- Null (undefined variables has null value .Ex : $x)
- Resource
In C,C++,JAVA we have restriction to define a variable with data type .But in PHP we are free to define variable without data type. PHP variable is also known as dynamic variable
No comments:
Post a Comment