Archive for the 'PHP' Category

Strategy-like Pattern in PHP

February 19th, 2009 Posted in Design Patterns, PHP | Comments »

Today, I had some time to write a little program while I was watching people work on the infrastructure at the office. I wrote up a couple of functions that calculated the n-th Fibonacci number, and wanted to display the sequence of the first 100 numbers as they were calculated by these functions. At first, […]

General Array Sorting in PHP

December 23rd, 2005 Posted in PHP | Comments »

PHP offers several array sorting functions. These array sorting functions sort array values only ( “sort” ), rearrange array values by sorting the array key ( “ksort” ), or rearranging array keys by sorting the array values ( “asort” ). Reverse sort functions rsort, krsort, and arsort are also available. In addition to these simple […]

Polymorphism in PHP

December 8th, 2005 Posted in PHP, Software Engineering | 18 Comments »

While thinking about a programming language deficiency, I rediscovered polymorphism. Overloading a function allows a function call to behave differently when passed variables of different type. I was trying to devise a method of simulating function overloading, because PHP does not support it. I considered implementing a function with an if-else statement ladder that tests […]

Misguided Response on XML-RPC Worm

November 15th, 2005 Posted in IT Administration, PHP, Security | Comments »

A recent worm, Lupper, is traversing the Internet and exploiting computers that run the XML-RPC package for PHP. The official XML-RPC for PHP homepage states that the package’s abuse of the PHP eval function created a security hole that allowed remote execution of arbitrary code. This means that any systems that run PHP and a […]

Function Overloading and PHP

August 3rd, 2005 Posted in PHP, Software Engineering | 23 Comments »

I’m proud of writing elegant code that can be easily read and intuitively understood. I use whitespace to increase my code’s readability, and I utilize simple, specialized programming language constructs to make my code more concise. For example, I’ll use PHP’s foreach construct, instead of a traditional for loop, to eliminate unnecessary indexers. This construct […]