Session values are stored on server but its records are kept through cookies.
The addslashes function is used to escape data before storing into the database.
The stripslashes function is used for removing the escape characters before apostrophes in a string.
‘asort’ sorts the array by its value in ascending order. On the other hand, ‘ksort’ displays the data by its keys.
Push function of array is used for inserting new elements into array. And ‘pop’ function of array is used for taking out last element of the array.
The strip_tags() function is used to remove all the html tags from the data.
When any data member (variable or function) is declared as ‘protected’ that means these data members can be inherited by its child class only. First the data members have to bring into child class then it can be accessed outside.
When a variable is declared as static, its value is retained and not destroyed/overwritten like normal variable. Normally it’s declared inside any function. So when function is called more than one time, its value is retained from the first one.
When a variable is declared outside the function, it’s called global variable and when a function is decaled inside a function, it’s called local variable.
We have to use ‘GLOBAL’ keyword before that variable inside function, and then it can be accessed inside the function.
When a class is declared static that means its data members can be accessed without creating the object of that class.
enctype=”multipart/form-data” is actually HTML code and it’s used in any form. It’s an encoding and before sending any file this encoding has to be done. Without encoding file upload is not possible.So, multipart/form-data is used when a form requires binary data.
The array in which keys and values both are defined then it’s called associative array.
To pass a variable by reference, an ampersand sign is used in front of the variable.
$var1 = &$var2
Now, $var1 will hold the address of variable $var2
In PHP thereis feature called internal typecasting where PHP comprehend the ‘type’ and changes into that data type.
echo “Yes! Both are equal”;
echo “No both are not equal”;
Output will be: yes! Both are equal.
Both ‘count’ and ‘sizeof’ are used for counting the number of array elements.
In switch case, if we provide wrong value, the value which is not specified, then we the ‘default:’ control statement of switch case displays the value.
Ternary operator is the operator which is written in single line statement. It’s concise form of if else.
We write like this echo $val= $a>$b? “A is greater than B”:”B is greater than A”;
substr is a function which is used to display the truncated version of the text.
Its written like :substr($string,start_limit,end_limit). Say if start point is 0 and end LIMIT is 200 then it will display 200 characters.
Constructor is a special function whose name is same as class name. The benefit of the constructor is that when an object of the class is created, it gets called automatically. It does not have to call separately. The ‘destructor’ method is called as soon as there are no other references to a particular object.