Well, throughout the last few weeks on developing my web application, I’ve stumbled across many useful PHP functions that might have gone unnoticed by many people. I, for one, had no idea that these functions existed until I saw it in the documentations from PHP’s website.
extract()
I use this quite often. This function will extract a given array to import them to the current symbol table. In other words, each element in an array will be set as it’s own individual variable once extracted.
Example:
$arr = array('hello'=>'world','foo'=>'bar'); extract($arr); echo $hello; //outputs "world" echo $foo; //outputs "bar"
This will “generate a better random value”. According to PHP’s docs, this can produce a random number 4 times faster than the regular rand() function.
I’m pretty sure many people don’t know about this function. This function will delete a file. Even in PHP’s documentation, the delete() function was created as a dummy entry to forward people to the unlink() function since many people won’t think of the word “unlink” whenever they want to delete a file through a PHP script.
Much like those image functions or path functions that breaks up the filename into an array containing all the information of it’s entity. This function will break up a URL string into an array containing various components of that URL such as the protocol, hostname, path, etc.
This proves to be quite useful for those who are building their own metrics application or anything similar. This function will return an array of all the meta tags of a given file, or even a URL.
There are quite a number of them. These functions basically checks for all characters in a given string to see if they satisfy the type’s function. For example ctype_alpha() will check a string and return true if all characters of that string is an alphabetic character.
If you’re like me an a client asks for a calendar application. This function will be of good use as it will return you the number of days in a given month of any calendar you want to specify.
If you’re web application is complex, or you just fill like putting a limit on the server load, you can use this function. It could be useful, when you want to start charging for bypass peak hours of activity.

