php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41277 Parse error when getting an array element after function call
Submitted: 2007-05-04 06:33 UTC Modified: 2007-05-04 06:35 UTC
From: furax at yandex dot ru Assigned:
Status: Not a bug Package: Compile Failure
PHP Version: 5.2.2 OS: Windows
Private report: No CVE-ID: None
 [2007-05-04 06:33 UTC] furax at yandex dot ru
Description:
------------
I've tried to get an element of array, returned by function getArray() (user-defined).

Reproduce code:
---------------
<?php
function getArray()
{
  return array('Useful data', 'Some useless data');
}

$data=getArray()[0];

?>


Expected result:
----------------
$data='Useful data'

Actual result:
--------------
Parse error: syntax error, unexpected '[' in Z:\home\test\www\bad1.php5 on line 7


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-04 06:35 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Aug 01 14:00:02 2025 UTC