What's happening in our world

Home / Blog / The Hidden Mysteries of PHP

Thursday 02nd January 2014 The Hidden Mysteries of PHP

Ah, the age old bane of programmers: documentation. Or, more specifically, the lack thereof, especially when it comes to working with someone else's code. However, the problem can sometimes be compounded a thousand-fold for the actual creators of a programming language, as they have a far more comprehensive and staggering task ahead of them. This is especially true for a language like PHP, which as you may or may not know, arose from a set of tools coded by one intrepid web developer in the early 1990s by the name of Rasmus Lerdorf. PHP, or Personal Home Page Tools as it was known originally, has since grown to become the most widely used programming language on the web, and the documentation that comes along with PHP has also been developed into a fairly robust and well put together guide to the language.
 
Many web developers learned the language without ever actually touching the manual, however, and may be slightly surprised by some of the amusing tidbits of information that are scattered throughout the official PHP documentation. In fact, as user-generated content in the documentation grew, a website sprang up dedicated to bringing these bits of hilarity and inexplicability to light, named 'PHP Manual Masterpieces', which is worth a visit if you have some time and you love (or are simply curious to learn more about) PHP.
 
One of the things that has perplexed PHP developers since the very beginning of the language was the structure of the function names. They're sort of all over the place, and PHP Manual Masterpieces highlighted this issue when they brought to light a hilarious revelation from Lerdorf in a forum exchange. Another developer asked Lerdorf what the rational was, to which he replied, "Back when PHP had less than 100 functions and the function hashing mechanism was strlen(). In order to get a nice hash distribution of function names across the various function name lengths names were picked specifically to make them fit into a specific length bucket. This was circa late 1994 when PHP was a tool just for my own personal use and I wasn't too worried about not being able to remember the few function names."
 
Yup, you read that right. PHP functions were renamed simply to make them fit a certain length, which explains why so many developers have torn out their hair trying to work with them. But hey, we still love you, PHP.

Posted on January 02nd 2014 at 06:03pm

Leave a Comment

Your Name
Your Email Address
Your Website
Your Comment
Send Comments

Links

TRY SOURCEGUARDIAN FREE FOR 14 DAYS
Account Login:

login Forgotten Password?
Connect with us
Bookmark
facebook linkedin twitter rss
© Copyright 2002 - 2018 SourceGuardian Limited
Privacy Policy l Terms & Conditions l Company Info l Contact us l Sitemap l PHP Weekly News