|
Posted by Jochem Maas on 03/15/05 22:16
André Pletschette wrote:
> Thankyou,
>
> That works ;)
>
> Here the code:
> $get_table_fields_cmd = $classname."::intializeClass(\$dbConnect);";
> eval($get_table_fields_cmd);
welldone for figuring a way to do it! I have to tell you tho that eval()
is a very heavy function to use - my advice don't use it unless you have
to, and in this case you have a faster alternative:
$returnVal = call_user_func(array($classname, 'initializeClass'), $dbConnect);
see also return call_user_func_array() which offers more
flexible argument passing in cases where you may not know
exactly how many args have to be passed beforehand.
also note that you don't need the var $get_table_fields_cmd
(and notice the use of single quotes because no string interpolation
needs to be done):
eval($classname.'::intializeClass($dbConnect);');
>
> André
>
>
>
> François-Xavier Lacroix wrote:
>
>> Maybe With the eval() function ?
>>
>>> Hi,
>>>
>>> What do I have to do to call a function from $classname?
>>>
>>> Like: $classname->test( );
>>>
>>> Thankyou,
>>> André
>>>
>>
>
>
Navigation:
[Reply to this message]
|