PHP Sorting Arrays
There are a total of eleven functions in the PHP core whose only goal is to provide various methods of sorting the contents of an array. The simplest of these is sort(), which sorts an array based on its values:… (READ MORE)
There are a total of eleven functions in the PHP core whose only goal is to provide various methods of sorting the contents of an array. The simplest of these is sort(), which sorts an array based on its values:… (READ MORE)
Iteration is probably one of the most common operations you will perform with arrays— besides creating them, of course. Unlike what happens in other languages, where arrays are all enumerative and contiguous, PHP’s arrays require a set of functionality that… (READ MORE)
As we mentioned in the PHP Basics , a number of operators behave differently if their operands are arrays. For example, the addition operator + can be used to create the union of its two operands: <?php $a = array(1,… (READ MORE)
Arrays are the undisputed kings of advanced data structures in PHP. PHP arrays are extremely flexible—they allow numeric, auto-incremented keys, alphanumeric keys or a mix of both, and are capable of storing practically any value, including other arrays. With over… (READ MORE)
The heart of PHP programming is, arguably, the function. The ability to encapsulate any piece of code in a way that it can be called again and again is invaluable—it is the cornerstone of structured procedural and object oriented programming…. (READ MORE)
Errors are an integral part of every computer language—although one that, most of the time, programmers would rather not have to deal with! PHP has some excellent facilities for dealing with errors that provide an excellent level of fine-grained control… (READ MORE)
Control structures allow you to control the flow of your script—after all, if all a script could do was run from start to finish, without any control over which portions of the script are run and how many times, writing… (READ MORE)
As their name subtly suggests, operators are the catalysts of operations. There are many types of operators in PHP, those commonly used are: • Assignment Operators for assigning data to variables • Arithmetic Operators for performing basic math functions •… (READ MORE)
Conversely to variables, constants are meant for defining immutable values. Constants can be accessed for any scope within a script; however, they can only contain scalar values. Constant names, like variables, are case-sensitive; they also follow the same naming requirements,… (READ MORE)