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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 09:01:27 2025 UTC