The Travails of Traversal

13 07 2016

Flickr: By JacobDavis

The venerated foreach-loop may seem to have formed a part of PHP from the outset, but it actually entered the language starting with PHP 4, apparently appropriated from Perl. While nowadays, this control structure provides a convenient way to iterate over an array or object without the complication of conditional looping inherent in for, while, and do-while loops, it was originally intended to provide a way to easily traverse arrays (see PHP Manual published 3-6-2003). Read the rest of this entry »





The Erroneous Basis of base_convert()

29 01 2016

July

July (Photo credit: kurafire)

Some bugs linger from one version of PHP to the next, such as the one associated with base_convert() and other base conversion functions. It has existed at least since the long, gone days of PHP 4. It even managed to escape the notice of Eevee in his encyclopedic rant railing against PHP a few years ago. An understandable oversight, given that nowadays developers usually apply themselves to other endeavors than converting values from one base to another. Read the rest of this entry »





PHP: Classy Dynamics

16 01 2016

flickr: by JusDaFax

Devotees of PHP may worry with the debut of PHP 7 that users have lost the beloved language we’ve known over the past twenty years. In truth, the newest version generally conforms to previous ones. In fact, the advent of PHP 7 heralds a technology distinguished by greater flexibility and consistency.

Read the rest of this entry »





Modulating the Modulo

28 11 2015

Flickr: by by Toño Garces

 

A recent article contrasting PHP with Ruby, denigrates making comparisons of one language with others, dismissing such efforts as worthless save for being a clickbait strategy. Yet, sometimes the best way to understand the familiar requires venturing out and exploring something new. If one only knows PHP, a developer may still write quality code. But, learning about C, JavaScript and Python, all of which have influenced PHP, may enhance one’s appreciation for its nuances.And, let’s not forget the other “P” in the pod, Perl, which had a pivotal bearing on PHP’s early development. Speaking of Perl, its creator Larry Wall drew inspiration from UNIX. Of particular interest, that operating system’s (OS) Bourne Shell has an open-sourced cousin bash (the “Bourne Again Shell”), knowledge of which may also enhance one’s appreciation for PHP. Read the rest of this entry »





The Real Error

22 07 2015

flickr: by Poulepondeuse

Sometimes a PHP script may produce an inconsistent type of error, i.e. in one version of PHP a less serious parse error displays while in another version a fatal error message appears.  Read the rest of this entry »





Hello, Again!

31 12 2014

Flickr: by rdohms

I chanced upon some amusing JAVA code today and decided to translate it into PHP. Here’s the code:

Read the rest of this entry »





PHP: Going to Zero

2 12 2014

Flickr: by djniks

Following in the tradition of its predecessor Perl, PHP has its own secret operators (see “Inchworm on a Stick“).Today let’s explore the heretofore unknown PHP operator, “->”, most remarkable for quickly reducing a numerical value to zero.  At first sight, one might mistake this symbol for PHP’s arrow operator designed to access an object’s properties and methods, until one realizes that two hyphens instead of one distinguish this arrow.  So, why have we yet to hear about this new operator? What is its name and why does the operator precedence table (see Manual) neglect to include it?

Read the rest of this entry »








%d bloggers like this: