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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 18:01:34 2024 UTC