ID:               46120
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mephtu at yahoo dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Feature/Change Request
 Operating System: Ubuntu Linux
 PHP Version:      5.2.6
 New Comment:

That has never worked, not even for variables. All of the following
will work fine:
$t = 'do_'.$tag;
$t();

Your problem is that your syntax is basically impossible. It can not
distinguish between:
$'do_' . tag();
which might be either something remotely looking like a variable (parse
error'd of course) followed by a concatenation operator, followed by a
function call to function tag(). OR
which might be that you want to concatenate everything together, and
THEN execute the function by that name.

The thing is, the parser can't differentiate between those two, so it
doesn't even try. You can already execute "ad hoc function variables",
as long as you use proper syntax.

It is unfortunate that something like:
${'do_'.$tag}();
does not work, but instead returns 
Fatal error: Function name must be a string

Anyway, marking as bogus since you already can do this.


Previous Comments:
------------------------------------------------------------------------

[2008-09-19 03:09:01] mephtu at yahoo dot com

Description:
------------
I want to be able to execute ad hoc function variables.



Reproduce code:
---------------
<?php
function do_bucket() {
  echo 'Hello, world!';
}

$tag = "bucket";
$'do_'.tag();
?>

Expected result:
----------------
Hello, world!

Actual result:
--------------
Error.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=46120&edit=1

Reply via email to