PHP

We upgraded PHP to 5.6 on our Linux server today, and i'm satisfied with the result :)
IMO PHP 5.4 trait feature worth all the troubles of upgrading an object oriented PHP code base

Linux Shell Bridge (Passing variables from scripting langauges like PHP to Linux Shell)

Blog
Linux
PHP
Programming
Sys Administration

It might sound strange at first but i must say that it's very useful specially if you have shell scripts as part of your application. Usually For making this scripts as automated as possible there should be a way to reuse the application's configurations (ips, passwords , etc) and not having to update a separate configuration file whenever anything changes in the application. It's not limited only to this and can be used to pass any kind of variables.

4
Your rating: None Average: 4 (2 votes)

Sorting two dimensional array like query result by sub array's key in PHP

Blog
PHP

PHP offers dozens of functions for sorting arrays, but unfortualey non of this functions support sorting by sub-key's value out of the box. It's very useful when you want to sort the result of a query by an specific column.

Sample :

3
Your rating: None Average: 3 (3 votes)

PHP's forward compatible version compare

Blog
PHP
Programming

Sometimes the code is forward compatible, for example when it's compatible with all future PHP5 releases, put PHP's version_compare function does not support this (Perhaps because they know that they always break compatibility with every minor release!!!). This function supports .x, for the above example it's : 5.x

It's also shared here

0
Your rating: None

Unix like smart recursive file/folder copy function for PHP

Blog
PHP

PHP's file system manipulation functions are not as complete as they should be specially when it comes to manging recursive folders. For addressing part of this issue i decided to write a smart function which can handle recursive file/folder copy easily.

As you may have noticed there are feature that i didn't have time to implement , so if you have time to extend this function please notify me as well :). It's also shared here

2.1
Your rating: None Average: 2.1 (30 votes)

Alpha support for PHP's imagecopymerge function

Blog
PHP
Programming

I've just checked PHP's issue tracker and a core developer says that this function (imagecopymerge) was never meant to support alpha channel! and they refused to commit the provided patch! so ridicules Anyway i tried rodrigo's workaround and it worked quite well, thanks rodrigo for sharing it. I came up with another idea which is much faster than his solution, (it may need a little bit more memory)

4
Your rating: None Average: 4 (5 votes)

Update/Upgrade/Install XAMPP (LAMPP) modules by Compiling

Linux
PHP
Sys Administration

This article is not finished yet and it might not work for you at all, if you're still interested you can subscribe to its rss so you will be noticed whenever i update it.

XAMPP source code http://www.nat32.com/xampp/index.htm

http://www.apachefriends.org/f/viewtopic.php?f=16&t=34411

3.18182
Your rating: None Average: 3.2 (11 votes)

PHP5 and Exception handling

PHP
Programming

 

Introduction

Quite some time ago i dropped php4 support on all of my projects and started thinking how i can benefit from PHP5 new features specially the new exception handling system. due to the fact thatPHP4 had no official exception system, programmers had to come up with their own way for handling exceptions properly , one this solutions was PEAR ERROR which i think was very useful, and i think that even thought PHP5 developers no longer need that technique it still can be used for better code quality in various circumstances.

2.375
Your rating: None Average: 2.4 (8 votes)