PHP 5 Sorting Arrays

PHP 5 Sorting Arrays

The elements in an array can be sorted in alphabetical or numerical order, descending or ascending. PHP – Sort Functions For Arrays In this chapter, we will go through the following PHP array sort functions: sort() – sort arrays in ascending order rsort()...
PHP 5 Arrays

PHP 5 Arrays

An array stores multiple values in one single variable: Example <?php $cars = array(“Volvo”, “BMW”, “Toyota”); echo “I like ” . $cars[0] . “, ” . $cars[1] . ” and ” . $cars[2]...
PHP 5 Functions

PHP 5 Functions

The real power of PHP comes from its functions; it has more than 1000 built-in functions. PHP User Defined Functions Besides the built-in PHP functions, we can create our own functions. A function is a block of statements that can be used repeatedly in a program. A...
PHP 5 for Loops

PHP 5 for Loops

PHP for loops execute a block of code a specified number of times. The PHP for Loop The for loop is used when you know in advance how many times the script should run. Syntax for (init counter; test counter; increment counter) {   code to be executed; } Parameters:...
PHP 5 while Loops

PHP 5 while Loops

PHP while loops execute a block of code while the specified condition is true. PHP Loops Often when you write code, you want the same block of code to run over and over again in a row. Instead of adding several almost equal code-lines in a script, we can use loops to...