Jump to content

How to call __construct() in a class by a variable


RoBiNp

Recommended Posts

This works normally:

$nameOfClass = 'SomeExistingClass'; // class name

$obj = new $nameOfClass();

echo $obj->someExistingFunction(); // display class

I want to use __construct() but changing someExistingFunction() to __construct() causes for some mysterious reason double mysql queries, double print_r() and double echo (function returns behave normally).

 

So how should I call __construct() ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.