note 52952 added to function.call-user-func

From: Date: Wed, 18 May 2005 20:00:28 +0000
Subject: note 52952 added to function.call-user-func
Groups: php.notes 
Request: Send a blank email to php-notes+get-89598@lists.php.net to get a copy of this message
It seems like call_user_func() can not be used to create Objects via the new Command. The Following example dosen't work: <? include_once(class_".$type.".php"); $object = new call_user_func ('bdv_'.$type); ?> But this works: <? include_once(class_".$type.".php"); $constr = 'bdv_'.$type; $object = new $constr(); ?> ---- Manual Page -- http://www.php.net/manual/en/function.call-user-func.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52952 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52952&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52952&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52952&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52952&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52952&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52952&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#89598) next »