The behavior of unset() inside of a function can vary depending on what type of variable you are attempting to destroy. If a globalized variable is unset() inside of a function, only the local variable is destroyed. The variable in the calling environment will retain the same value as before unset() was called. Example <?php…
Read MoreError handling is the process of catching errors from the program and then taking appropriate action. Before proceeding for error handling you should get to know how many types of errors occurred in PHP. Notices: These are non-critical errors that occurred while executing a script – for example, accessing a variable that has not yet…
Read MoreString functions are the most important functions frequently used in PHP. String is the sequence of characters, like “Let’s learn String functions”. There is no installation required to use string function. Example <?php $name = “Hirdesh Bhardwaj”; print($name); ?> String Concatenation Operator To concatenate two string variables together, we use the dot (.) operator −…
Read MoreThe Include() and require() statements are used to insert codes written in other files, in the flow of execution. The main of using include and require functions to integrate one page code or content into another page. You can maintain usually some repeated functionality in the form of PHP file and finally you can call…
Read MoreA While loop is used when we have to repeat a set of statements as long as the condition is false. It could be the best where number of repetition is not known earlier or in advance. It can be explain in plain English as “Keep doing something until a condition is true”. Syntax: while…
Read MorePHP for loop can be used to traverse set of code for the specified number of times. For example if you want to repeat something ten or twenty times. It should be used if number of iteration is known otherwise I recommend you to use while loop. Syntax: for (Initialization; Condition; Progressive) { //set of…
Read MoreAn array is a data structure that stores similar type of values in a common variable. Arrays are also called homogeneous data type. For example if you want to store 50 numbers then instead of defining variables it is easy to define an array with size of 50. In PHP, the array() function is used…
Read More