#43486 [Opn->WFx]: Be able to use following format: $class->function()[index]

From: Date: Mon, 03 Dec 2007 15:59:57 +0000
Subject: #43486 [Opn->WFx]: Be able to use following format: $class->function()[index]
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120329@lists.php.net to get a copy of this message
ID: 43486 Updated by: derick@php.net Reported By: sbbritton911 at hotmail dot com -Status: Open +Status: Wont fix Bug Type: Feature/Change Request Operating System: Debian PHP Version: 5.2.5 New Comment: This has been brought up many times - it's not going to happen. Previous Comments: ------------------------------------------------------------------------ [2007-12-03 15:42:12] sbbritton911 at hotmail dot com Description: ------------ In using inline functions that return arrays, please make php capable of using values stored at particular indexes. For example, $class->function_call()[index] or ($class->function_call())[index]. Basically, the same use as other langauges. Thank you for your time. Sincerely, Scott B Britton Reproduce code: --------------- class test { private $scott = array("Scott", "B", "Britton"); public function return_scott() { return $this->scott; } } $s = new test(); printf("%s", $s->return_scott()[0]); Expected result: ---------------- I expected to see "Scott" printed to the screen Actual result: -------------- Syntax error, unexpected '[' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43486&edit=1

« previous php.bugs (#120329) next »