php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #7728 Dynamic function names
Submitted: 2000-11-09 11:05 UTC Modified: 2000-11-09 11:19 UTC
From: ignacio at openservices dot net Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.3pl1 OS: %
Private report: No CVE-ID: None
 [2000-11-09 11:05 UTC] ignacio at openservices dot net
The following works:
"""
$abc="ABC";
$t=$abc."123";
$t(); // Calls ABC123()
"""
but there's no obviously apparent reason that:
"""
$abc="ABC";
($abc."123")();  // Calls ABC123()
"""
shouldn't work the same way.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-09 11:14 UTC] derick@php.net
You can use:

${$abc."123"}

note the curly braces.
So there is no need for this "feature".
 [2000-11-09 11:19 UTC] ignacio at openservices dot net
Umm...no. That attempts to call $ABC123(), which is not the same thing.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 19:01:30 2024 UTC