Tagged: PHP


PHP do-while loop

The main difference between a while and do-while loop is that in a do-while loop, the statements in the loop will be executed at least once.


PHP while loop

A while loop is used to repeatedly execute a set of statements as long as the condition remains true.


PHP foreach loop

Unlike a for loop, the PHP foreach loop works only with arrays and objects. The foreach loop starts with the first element of the array and during each iteration, the next array element is fetched.


PHP for loop

A for loop is used to execute the program for a fixed number of times. For loop in PHP is similar to that in C, C++ or Java.


Connect PHP to MySQL

To access the data stored in a MySQL database, you should first connect to MySQL database server. PHP offers two different ways to connect with the MySQL database.


Sending emails using PHP

The PHP mail() function is used to send emails from the script. This function has three mandatory parameters and two optional parameters.


PHP addslashes Function

The PHP addslashes function is used to add backslashes in front of some predefined characters in a string. This function is case-sensitive.


Escape characters in PHP

Escape characters are the equivalent characters for a purpose. The main purpose of using an escape character is to notify the compiler or interpreter, that a particular character is having special meaning rather than it’s normal meaning.


PHP chop Function

The PHP chop function is used to remove white-space or other characters from the right end of a string. This is an alias of rtrim() function and is case-sensitive.