PHP Scripts

Posting to Twitter Using the load() Function for PHP
Due to the super simple API that's provided by twitter, its very easy to post to Twitter. And thats made even simpler by using the load() function. As simple as this...
PHP Function to Check Domain Availability
This function will check for the availability of the domain you gave as the argument. Note: This script will only work in Linux system - it uses the whois command to do the lookup.
Image Class - GD Wrapper
This is a wrapper class for the GD Library in PHP. You can use this to manipulate images. Please note that you must have GD installed in the server for this class to work as advertised.
joinPath() - Combines Multiple Path Fragments
This function will combine all the path fragments provided as the argument and return the result. joinPath() will use the correct path separator for the current platform.
SqlPager PHP Class
SqlPager PHP class make paging very simple - just provide it with the query to page, and it will do the rest. It uses the LIMIT keyword to do this. Currently, it support only MySQL.
ls() - Return Folder Contents
The ls() function will take a pattern and a folder as the argument and go thru it(recursively if needed)and return the list of all files in that folder.
Functions to Import/Export CSV data
These two function make it very easy to import and export CSV in PHP.
PHP Function to Create URLs - getLink()
getLink() is a function that will make creating URLs much easier. This function expects two arguments - the first argument is the URL and the second one is an array with all the parameters that should be passed with the URL. The function will combine the existing URL with the parameter array and return the resulting URL.
load() Function for PHP - Fetch URL Content

I recently had to develop a small script that will fetch an XML file from the web. All I had to do is download a given URL and read its contents. To my great surprise I found that download the file using my jx Ajax library was much easier than doing it with PHP.

PHP make this very easy by including functions like file_get_contents() that has URL support. Unfortunately, this is a huge security threat - and many servers have disabled this feature in PHP. PHP provide other two method to fetch an URL - Curl and Fsockopen. But to use this I have to write a lot more code. So I decided to create my own function that makes it much more easier.

iFrame PHP Framework
iFrame is my PHP framework - developed for personal use and distributed under the BSD License. I will not recommend using this framework for your projects.
Upload Function
Uploading a file using PHP is not a single step function. To make this easier, I have created a function that will upload a file with just one function call. Just upload('image'); and the file is uploaded! upload() is a function that makes uploading files very easy.
Element Deletion from Array
PHP have a large number of native functions for array operations. When I am coding in javascript, I envy this feature of PHP. Many people have gone to the extend of porting the most needed functions over to javascript. However, you will find that one function is missing in PHP - the remove function for an array element.
Dump() Function - Formated print_r()
The print_r() is a very valuable function for all PHP developers. However, there is two problems with this function -
xml2array() - XML Parser for PHP
xml2array() is a easy to use PHP function that will convert the given XML text to an array in the XML structure. Kind of like my Javascript xml2array() function.
array2json() - Convert PHP arrays to JSON
array2json is a PHP function that will convert the array given as its argument into a JSON string. The created JSON string will be returned. This is very useful in Ajax apps using JSON over XML. If you are using XML, you better off using my xml2array() JavaScript function.
Benchmarking Script - Timer
Time the execution of your script using this simple script.
sql2json() - Converts SQL Results to JSON String
sql2json() converts the result of the given SQL query to its equivalent JSON string.
Query() Function
query() function will accept a query as its argument and return the data in different formats based on the result of the query.
Subscribe to Feed