php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52270 Anonymous functions :: Example #2 :: parse error, unexpected T_FUNCTION
Submitted: 2010-07-07 00:30 UTC Modified: 2010-07-07 00:37 UTC
From: user at niepodam dot pl Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.2.13 OS: Windows/Linus
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: user at niepodam dot pl
New email:
PHP Version: OS:

 

 [2010-07-07 00:30 UTC] user at niepodam dot pl
Description:
------------
http://www.php.net/manual/en/functions.anonymous.php

example #2 produce error:

Parse error: parse error, unexpected T_FUNCTION in ./ on line 4

Test script:
---------------
<?php
$greet = function($name)
{
    printf("Hello %s\r\n", $name);
};

$greet('World');
$greet('PHP');
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-07 00:37 UTC] johannes@php.net
-Status: Open +Status: Bogus
 [2010-07-07 00:37 UTC] johannes@php.net
The page has a box telling you:

    Note:  Anonymous functions are available since PHP 5.3.0.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Dec 16 21:00:02 2025 UTC