Tag: PHP

  • Testing multiple browsers with Selenium2 in PHPUnit

    You used to be able to run test on multiple browsers with PHPUnit Selenium test class by specifying a $browsers property. You can still do the same with PHPUnit’s Selenium 2 class made for web driver. Here is how you do it: class SomeTest extends PHPUnit_Extensions_Selenium2TestCase { /** * Variable to specify which browsers to…

  • Fastest way to traverse an associative array

    PHP has array_walk() which can be used to traverse an array and modify it in place. I wanted to find out if array_walk() would be faster than a loop written in PHP (for, foreach). I mean, PHP’s code is written in C/C++ and traversing anything has to be faster in C than in PHP. So,…

  • PHP Inheritance – Calling parent’s functions in child object

    Before I begin, let me just say that I have tested this in PHP 5.2. I don’t know if this will work for PHP 5.3. If anyone can confirm that it does, it will be great. You can do it with parent::someFunctionName(). You can do this from within an overloaded function also. It was confusing…

  • PHP and Sabre

    What is Sabre? Sabre is a company that has data of all flight schedules, etc. And, using their system, you can book flights, hotels, rent cars, etc. Getting PHP to talk with Sabre I tried PHP Soap and nuSoap. They both didn’t work for me because of their limitations. So I ended up writing a…

  • Design Patterns – Singletons in PHP 5.x

    Design Patterns (and anti-patterns) are techniques of programming. There are a lot of design patterns. It is upto the programmer to pick and choose which patterns to use based on their needs. Singleton is also a design pattern. A singleton is a type of class which can have only 1 object of its kind through…