php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53408 Calling a function returned from a function in one line
Submitted: 2010-11-25 21:23 UTC Modified: 2010-12-01 15:26 UTC
From: softwareelves+php at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3.3 OS: Any
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: softwareelves+php at gmail dot com
New email:
PHP Version: OS:

 

 [2010-11-25 21:23 UTC] softwareelves+php at gmail dot com
Description:
------------
Since we can now pass around function much easier, It would be beneficial to be 
able to "chain" together function calls.

Test script:
---------------
<?php

function returnClosure() {
    return function() {
        print "helloworld";
    };
}

returnClosure()();

Expected result:
----------------
helloworld

Actual result:
--------------
Parse error: syntax error, unexpected '(' in test.php on line 9


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-30 19:50 UTC] felipe@php.net
There is a RFC for such. http://wiki.php.net/rfc/fcallfcall
 [2010-11-30 19:50 UTC] felipe@php.net
-Package: Unknown/Other Function +Package: Scripting Engine problem
 [2010-12-01 15:26 UTC] jani@php.net
-Status: Open +Status: Bogus
 [2010-12-01 15:26 UTC] jani@php.net
And there are other requests for this already. Try search before spamming the bug database.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 10:01:33 2025 UTC