Everybody knows that php has a lot of functions. But how many is a lot? Well today I can say for a fact that it is somewhere around 4828. Now I know this probably isn’t the whole number but it’s probably pretty darn close. ” How did you arrive at this number?” one might ask. Well fret not! for I shall reveal my secrets.
I had recently been trying to figure out the ins and outs of Text Mate when I stumbled across a nice little php script which will grab some of the important bits out of the php online documentation and print it. I then modified this script to work a little more reliably, and rather than print the data to the screen I parsed it into variables which hold very specific parts of the documentation
I then looped through all of the functions found at us2.php.net/quickref.php and put them into my database.
[php]
for($c=0; $data[$c]; $c++){
$data[$c] = ltrim($data[$c]);
$data[$c] = rtrim($data[$c]);
$data[$c] = preg_replace(”/\s{2,}/”, ‘ ‘, $data[$c]);
}
$funcName = $data[0];
$funcVers = preg_replace(”/\(([^\)]+)\)/”, “$1″, $data[1]);
$funcDesc = preg_replace(”/–\s(.*)/”, “$1″, $data[2]);
$retArgs = explode(’(', $data[4]);
$funcReturn = preg_replace(”/^(\S+).*/”, “$1″, $retArgs[0]);
$funcArgs = substr($retArgs[1], 1, -2);
[/php]
Now I’m sure that the question on everyone’s mind is WHY? Well there is a simple answer to that: Remember how I said earlier that I was trying to figure out Text Mate? Well I was. And I didn’t. And then my trial expired. What I wanted it to do was automatically expand php functions so that I could see their arguments, but I couldn’t figure it out. So instead I plan on using my database of functions to create an xml file that I can use with TypeIt4Me… Or just keep using dreamweaver. Either/or Really.
at any rate Here’s the SQL Dump if anybody’s interested