|
Posted by Daz on 02/25/07 17:53
On Feb 25, 5:15 pm, "peter" <sub...@flexiwebhost.com> wrote:
> > Actually, PHP4 does support the mysqli object, also.
>
> > But in PHP5 your constructors are named __construct, not the class name.
> > So you need to change the constructor name in your class, and call
>
> > parent::construct(...)
>
> Just a correction of Jerry's post. As of php 5 the __constructor method was
> made available BUT the old constructor name is still useable.
>
> The class you are actually using (mysqli) does in fact use a contructor
> called mysqli as the following code snippet will demonstrate if you run it:-
>
> <?php
> function output_methods($obj)
> {
> $methods = get_class_methods($obj);
> foreach ($methods as $method)
> {
> echo "function $method()\n";
> }
>
> }
>
> output_methods("mysqli");
> ?>
Excellent! Just what I needed :)
I am wondering why constructors are different in PHP5. Surely anyone
coding portable scripts, would just use the PHP4 constructor
technique, as there's no guarantee that the server it needs to run on
is running PHP5. Some people have no control over what version of PHP
is installed if they are simply paying for a basic hosting account.
Fortunately for me, I have the choice between 4 and 5, but others
won't necessarilly be quite so fortunate.
Thanks for your help Peter. That's sure going to save me digging
through source code and scratching my head to to point of baldness.
Best wishes.
Daz.
Navigation:
[Reply to this message]
|