|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-07-21 16:25 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 01:00:01 2025 UTC |
Description: ------------ This bug applies at least through 4.3.2. Sorry about version, but I'm restricted to using rpm's, which means I can never get near the current version. If this disqualifies me from ever reporting bugs, please advise and I will stop. The explode function yields an array result, so you would expect the following statement to be syntactically correct: $result=explode($separator,$string)[$key]; However, that syntax yields a "parse error". The workaround is to assign explode to a variable first: $array=explode($separator,$string); $result=$array[$key]; Reproduce code: --------------- $result=explode(':','a:b:c')[0]; Expected result: ---------------- $result gets 'a' Actual result: -------------- Parse error: parse error