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
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: 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: Thu Dec 18 01:00:01 2025 UTC