Parse error on explode('-','foo-bar')[0] (for instance)

parsing, php

Solution

It's a limitation in the PHP parser. There's no reason why it can't support this form of reduction, it just doesn't.

Problem

Why doesn't php support this syntax: ``` $s = explode('-', 'foo-bar')[0]; ``` ?

Original source