The Official End to PHP 5.2

Posted on December 25th, 2010 by Sam

On December 16th the PHP development team announced the release of PHP 5.2.16 as the end of support for PHP 5.2; and encouraging developers to upgrade source code to PHP 5.3. With official support no longer available for 5.2, how long will it take before the mass of hosting providers transition to PHP 5.3? If left to the hosting providers own devices, as shown in the past, it could take some time before we see 5.3 as the de facto minimum version. As a community, if we push hard to provide our code for 5.3 and move away from 5.2, we can in effect push the hands of the hosting providers to offer PHP 5.3. With all the benefits of 5.3, we need to push our technology forward and not get lost with time. You can read the official news release, check out the ChangeLog for PHP 5.2.16, or beef up with the PHP 5.3 Migration Guide.

“What Is Web 2.0″ by Tim O`Reilly – Review

Posted on January 10th, 2010 by Sam

This may be a review of an old article, however I hear the misuse of the term too often not to bring it back to light. Sites tout there mystical ascension to “Web 2.0″ hood, labeling there site with “New 2.0 features!”, while the key components of the concept are missing. Tim O`Reilly was there with the birth of the Web 2.0 Conference, where Web 2.0 grew from being just a concept. Tim relays in his post “What Is Web 2.0” the origins of this term and how to determine a sites 2.0 credibility. Discussing the distinct differences between non-2.0 and 2.0-esk sites and applications to showing how AJAX and Web Services fit into the whole picture.

Tim explains “Web 2.0 doesn’t have a hard boundary, but rather, a gravitational core”, this defines the pattern, a foot print of an achievable goal. The whole article is expressed in a way that is compelling to read and leaves you with food for thought. This is a must read for anyone itching to label anything Web 2.0!

Revisiting the BASICs

Posted on September 26th, 2009 by Sam

The glow of the screen off the keyboard.

The glow of the screen off the keyboard.

Sitting back, I’m remembering days when I spent hours trying to write some of the simplest code; appreciating what I went through to attain my current skill level, looking back upon the frustrations that make me smile.  Many years and programs ago (it was 1986, I was 6 going on 7), I came to the understanding that I could control something in my life: the computer!  My father played a key role in getting computers into the mainstream, and interesting me in coding.

I was greeted with hours of green on black text, learning the basics of program design, debugging the non-successful attempts, and gaining a greater understanding of my skills in coping with frustrations.  I was persistent, I was hooked, and at some times I felt like an addict, but never did I feel like quitting.  It was this emotional attachment and the hours of critique from over my shoulders which formed my habits that made me the developer I am.  I found that I was thinking differently in general.  My logic skills were growing and my diagnostic skills were blooming.

I still remember that daunting, thick, IBM-gray case and its brown three-ring binder – my bible of sorts.  Though I had someone I could ask questions of, I found it more fulfilling to scour through the `IBM BASIC Reference`.  Initially I read through the documentation a couple of times in the first two months.  My goal: to get a lay of the land, an idea of the different functions and commands held within, not remember all of them; this was a crucial element to my success.  I still find myself doing this today, not with the static content that are books, but with the new technology we call the internet.  I pull up php.net, navigate to the documentation, and just peruse it.

A lesson I learned really early on, after learning to cope with frustration, was that if you have an idea… wonderful.  However, until you have a plan, don’t bother coding!  Testing out concepts is one thing (and I strongly recommend it), but unless a solid deadline is near, work on a solid plan of design.  When I say design, I am referring to the process of breaking down the overall program into its essential building blocks.  The nice thing about building blocks, besides the re-usability factor, is that they can usually be broken down to smaller blocks.  Don’t believe me?  Think about something as simple as a user-defined function, nine chances out of a ten you’re using more than commands.  I guarantee you’re also using functions – maybe even a class or two.

Break it down!  Components of components of components: flow-chart the program, create some pseudo code, if anything else at least create a brain-blast chart (I like to use a white-board!).  After this process, assuming that deadline isn’t looming, determine if you can consolidate code and look through that tool-box of pre-written code that you have.  Now this is starting to look like a design!  As with learning and understanding any language, you modify the way you perform its art.  With this in mind, keep your box of tools up-to-date with your skills.  While I stood watching my father one day in his office, staring at one of the many screens and typing away furiously, I (unknowingly) took a step in a direction I have yet to regret!

Lambda Functions, Closures, and __invoke

Posted on April 26th, 2009 by Sam

Previously, lambda-style functions were only possible by using create_function. This has one major disadvantage, the function is compiled at run time, opcode caches can’t cache the function at compile time.

<?php
 
$func = create_function('$a,$b', 'return "ln($a) + ln($b) = " . log($a * $b);');
echo "New anonymous function: $func\n";
echo $newfunc(2, M_E) . "\n";
// New anonymous function: lambda_1
// ln(2) + ln(2.718281828459) = 1.6931471805599
 
?>

Read the rest of this entry »

Late Static Bindings

Posted on March 27th, 2009 by Sam

PHP 5.3 implements a feature called “late static bindings” that has been in the works since the PHP Developers Meeting that took place in November 2005 in Paris. This feature resolves an issue of inheritance, used to reference the called class in a context of static inheritance. Prior to version 5.3 a problem existed if the class was extended and a call was from the child class, “late static binding” alleviates this issue. The name is in reverence to the internal process, late bindings are computed using runtime information; as opposed to being resolved using the class where the method was defined. Read the rest of this entry »