Author: phpMoot
August 3, 2010
Perl Compatible Regular Expressions (normally abbreviated as “PCRE”) offer a very powerful string-matching and replacement mechanism that far surpasses anything we have examined so far. Regular expressions are often thought of as very complex—and they can be at times. However,… (READ MORE)
Author: phpMoot
August 3, 2010
PHP provides a number of different functions that can be used to format output in a variety of ways. Some of them are designed to handle special data types—for example, numbers of currency values—while others provide a more generic interface… (READ MORE)
Author: phpMoot
August 3, 2010
Comparison is, perhaps, one of the most common operations performed on strings. At times, PHP’s type-juggling mechanisms also make it the most maddening— particularly because strings that can be interpreted as numbers are often transparently converted to their numeric equivalent…. (READ MORE)
Author: phpMoot
August 3, 2010
Strings wear many hats in PHP—far from being relegated to mere collections of textual characters, they can be used to store binary data of any kind—as well as text encoded in a way that PHP does not understand natively, but… (READ MORE)
Author: phpMoot
August 2, 2010
Arrays are often used as stacks (Last In, First Out, or LIFO) and queue (First In, First Out, or FIFO) structures. PHP simplifies this approach by providing a set of functions can be used to push and pull (for stacks)… (READ MORE)
Author: phpMoot
August 2, 2010
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)
Author: phpMoot
August 2, 2010
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)
Author: phpMoot
July 30, 2010
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)
Author: phpMoot
July 30, 2010
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)