Bug->Req #55078 [Opn]: Can't use anonymous function inside array declaration inside a class

From: Date: Fri, 01 Jul 2011 22:46:57 +0000
Subject: Bug->Req #55078 [Opn]: Can't use anonymous function inside array declaration inside a class
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-161481@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55078&edit=1

 ID:                 55078
 Updated by:         felipe@php.net
 Reported by:        charlie at charliesomerville dot com
 Summary:            Can't use anonymous function inside array
                     declaration inside a class
 Status:             Open
-Type:               Bug
+Type:               Feature/Change Request
 Package:            Scripting Engine problem
 PHP Version:        5.3.6
 Block user comment: N
 Private report:     N

 New Comment:

This is just more one limitation, not a bug. Changing to feature request.
Thanks.


Previous Comments:
------------------------------------------------------------------------
[2011-06-29 23:54:37] charlie at charliesomerville dot com

Description:
------------
You can't declare an anonymous function in an array declaration inside a class 
declaration.

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

class Foo
{
	static $array = array("hi" => function() {
		phpinfo();
	});
}

Foo::$array["hi"]();

Expected result:
----------------
phpinfo being displayed

Actual result:
--------------
Parse error: syntax error, unexpected T_FUNCTION in /path/to/script.php on line 5


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55078&edit=1


Thread (4 messages)

« previous php.bugs (#161481) next »