Hi,
is there any benefit of using one of
the built in classes over a built in
function?
It all depends on how you did the conception and developpement of your application :
- if your application is based on Object-Oriented Programming, it makes sense to use the OO-interface (ie, classes)
- if your application is based on procedural programming, it probably makes more sense to use the procedural-interface (ie, functions)
In any case, of course, you can choose one API or the other, as you see fit -- the two points I wrote are no more than "logical guidelines", I'd say.
About that :
has these classes been there on
php.net for a long time?
Well, I'm guessing, for classes that belong to extensions bundled with PHP (like mysqli, for instance), that they are there since the extension they document exists.
In the case of mysqli, it means PHP 5, it seems (see, for instance, the PHP's version number on top of this page) -- so, I'd say since something like 2005 (I didn't check the date, but it's something like that)
As a sidenote, you have to take care about the fact that php.net hosts documentation for :
- functions / classes that are always bundled with PHP -- or, at least, almost never de-activated ; for instance, session
- functions / classes that are exposed by extensions that often come from PHP, and are hosted on the same SVN as PHP's sources... But not necessarily always compiled or actived -- for instance, mysqli or soap (I've worked on a server some time ago where I've had to compile those myself)
- functions / classes that are exposed by extensions that are not even hosted on the SVN containing PHP's source-code (or, in another directory, different from PHP's one) -- many of those extensions are available as PECL packages -- for instance : APC and it's documentation
Hope this helps make things more clear :-)