note 116611 added to functions.variable-functions

From: Date: Thu, 29 Jan 2015 09:01:34 +0000
Subject: note 116611 added to functions.variable-functions
Groups: php.notes 
Request: Send a blank email to php-notes+get-201549@lists.php.net to get a copy of this message
Variable functions can work with language constructs such as echo, print. Utilize wrapper functions to make use of any of these constructs as variable functions. you can see my example below <?php class test{ function doubi(){ return '111111'; } } $t = new test(); $func = 'doubi'; echo $t->$func(); echo "\n"; if(empty($t->$func())){ echo "empty functions"; }else{ echo "empty doesn't work"; } ?> output: root@ubuntu:/var/www/html/test# php f.php 111111 empty doesn't work ---- Server IP: 72.52.91.14 Probable Submitter: 124.127.252.126 ---- Manual Page -- http://php.net/manual/en/functions.variable-functions.php Edit -- https://master.php.net/note/edit/116611 Del: integrated -- https://master.php.net/note/delete/116611/integrated Del: useless -- https://master.php.net/note/delete/116611/useless Del: bad code -- https://master.php.net/note/delete/116611/bad+code Del: spam -- https://master.php.net/note/delete/116611/spam Del: non-english -- https://master.php.net/note/delete/116611/non-english Del: in docs -- https://master.php.net/note/delete/116611/in+docs Del: other reasons-- https://master.php.net/note/delete/116611 Reject -- https://master.php.net/note/reject/116611 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#201549) next »