note 76176 deleted from language.types.string by danbrown

From: Date: Tue, 17 May 2011 14:19:00 +0000
Subject: note 76176 deleted from language.types.string by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-179800@lists.php.net to get a copy of this message
Note Submitter: php at craigbuchek dot com ---- Function calls within double-quote variable interpolation work in PHP 5, but not quite as you'd expect. Basically the function has to be a variable function. I.e. a variable that holds the name of a function. So if you've got a function named 'x' that you want to call, you'll have to assign the function name to a variable. It's easiest to just assign it to a variable with the same name: function x () { return 4; } $x = 'x'; echo "x = {$x()}"; I'm not sure what the point of that is though, since it would be easier to do it this way: function x () { return 4; } $x = x(); echo "x = $x";

« previous php.notes (#179800) next »