Category: 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.


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.


PHP echo() Function

The PHP echo function is used to output one or more strings. As echo is not a real function, you are not required to use parenthesis with it