php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #289 PHP does not evaluate the () (Function call) operator correctly
Submitted: 1998-04-20 12:06 UTC Modified: 1998-04-24 10:23 UTC
From: kk at shonline dot de Assigned:
Status: Closed Package: Performance problem
PHP Version: 3.0 Release Candidate 4 OS: Solaris 2.5.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
1 + 18 = ?
Subscribe to this entry?

 
 [1998-04-20 12:06 UTC] kk at shonline dot de
Function calls with a variable name work as exspected when
called by a simple expression:

-----
<?php
 
function name_lang() {
        printf("I am a function\n");
}
 
$x = "name";
$y = "_lang";
$z = $x.$y;
$z();
Content-type: text/html
 
I am a function
-----


But PHP fails to parse the () function call operator in the
following environment:

-----
($x.$y)();
<br>
<b>Parse error</b>:  parse error in <b>-</b> on line <b>11</b><br>
-----



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-04-24 10:23 UTC] zeev
This syntax is not supported.  Only strings
and variables can be used as function names (not any
other expressions)

You can use
$foo = $x.$y;
$foo()

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 11:01:28 2024 UTC