Given the line of code, $result = pg_fetch_all(pg_query($dbconn, $query))[0];
locally, on my MacBook, it runs just fine. On Heroku, this is also the case. On Amazon EC2, however (using Amazon Linux, not that that makes a difference), this line shows up in my logfile and it doesn't allow it: PHP Parse error: syntax error, unexpected '[' in /var/www/html/index.php on line ...
Reading the docs, pg_fetch_all
returns a 0-based indexed array of associative arrays. So my question is, why can I not use pg_fetch_all(whatever)[0]
or is it just a weird quirk of Amazon's system?