{"action":"created","issue":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4464","labels_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4464/labels{/name}","comments_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4464/comments","events_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4464/events","html_url":"https://github.com/HaxeFoundation/haxe/issues/4464","id":99394703,"number":4464,"title":"PHP : array access to a function output is a bad PHP syntax","user":{"login":"bablukid","id":758807,"avatar_url":"https://avatars.githubusercontent.com/u/758807?v=3","gravatar_id":"","url":"https://api.github.com/users/bablukid","html_url":"https://github.com/bablukid","followers_url":"https://api.github.com/users/bablukid/followers","following_url":"https://api.github.com/users/bablukid/following{/other_user}","gists_url":"https://api.github.com/users/bablukid/gists{/gist_id}","starred_url":"https://api.github.com/users/bablukid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bablukid/subscriptions","organizations_url":"https://api.github.com/users/bablukid/orgs","repos_url":"https://api.github.com/users/bablukid/repos","events_url":"https://api.github.com/users/bablukid/events{/privacy}","received_events_url":"https://api.github.com/users/bablukid/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/HaxeFoundation/haxe/labels/platform-php","name":"platform-php","color":"fbca04"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-08-06T09:25:28Z","updated_at":"2015-11-27T08:02:56Z","closed_at":"2015-11-27T08:02:56Z","body":"Consider the following PHP code , which illustrates that an array access after a function is considered incorrect \r\n```\r\n<?\r\n// works fine\r\n$arr = array(\"toto\",\"tata\");\r\necho $arr[0];\r\n\r\n//dont work\r\nfunction getArr(){\r\n        return array(\"toto\",\"tata\");\r\n}\r\n\r\necho getArr()[0];\r\n```\r\n\r\nIt throws : \r\n```\r\nPHP Parse error:  syntax error, unexpected '[', expecting ',' or ';' in /root/test.php\r\n```\r\n\r\nIf I write it in the same way in Haxe, the generated PHP will follow the same structure which is bad : \r\n\r\n```\r\n//haxe\r\nreturn headers.get( name )[0];\r\n```\r\ngives\r\n```\r\n//php\r\nreturn $this->headers->get($name)[0];\r\n```\r\n\r\nObvisouly the workaround is to write it like this\r\n```\r\nvar h = headers.get( name ); \r\nreturn h[0];\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/comments/160063698","html_url":"https://github.com/HaxeFoundation/haxe/issues/4464#issuecomment-160063698","issue_url":"https://api.github.com/repos/HaxeFoundation/haxe/issues/4464","id":160063698,"user":{"login":"Simn","id":634365,"avatar_url":"https://avatars.githubusercontent.com/u/634365?v=3","gravatar_id":"","url":"https://api.github.com/users/Simn","html_url":"https://github.com/Simn","followers_url":"https://api.github.com/users/Simn/followers","following_url":"https://api.github.com/users/Simn/following{/other_user}","gists_url":"https://api.github.com/users/Simn/gists{/gist_id}","starred_url":"https://api.github.com/users/Simn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Simn/subscriptions","organizations_url":"https://api.github.com/users/Simn/orgs","repos_url":"https://api.github.com/users/Simn/repos","events_url":"https://api.github.com/users/Simn/events{/privacy}","received_events_url":"https://api.github.com/users/Simn/received_events","type":"User","site_admin":false},"created_at":"2015-11-27T08:02:56Z","updated_at":"2015-11-27T08:02:56Z","body":"This is the same as #4384."}}