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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kk at shonline dot de
New email:
PHP Version: OS:

 

 [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-2020 The PHP Group
All rights reserved.
Last updated: Thu Jan 23 04:01:24 2020 UTC