note 45335 added to function.eval

From: Date: Thu, 02 Sep 2004 15:13:19 +0000
Subject: note 45335 added to function.eval
Groups: php.notes 
Request: Send a blank email to php-notes+get-75940@lists.php.net to get a copy of this message
eval is also usefull when you try to invoke static method from class which name you have got on a variable. For example: class AAA { function validateInput($param) { return "AAA::validateInput($param)"; } } $parametry = 'oto parametr'; $nazwa_klasy = 'AAA'; eval("\$result = {$nazwa_klasy}::validateInput(\$parametry);"); //$result = ${nazwa_klasy}::validateInput($parametry); // this does not work echo $result; I have not found anything bettar then this (thanks to metempsychoza). misza ---- Manual Page -- http://www.php.net/manual/en/function.eval.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45335 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45335&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45335&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#75940) next »