简体   繁体   中英

PHP MySQLi function throws parse error on Linux, but not on Windows

I have a development server setup on my home office PC that is running Apache 2.4.3 with PHP 5.3.20 on Windows Server 2012. The other server is a Ubuntu Server 12.10 running Apache 2.4.2 with PHP 5.4.16. (yes, I see the version difference, except I can't find anything relating to this problem)

MySQLi is setup and replicated on both correctly, however, this line is not throwing any errors, or anything, however the page (and source code), stops at this line:

$id = mysqli_fetch_row($query)[0];

However it works on the Linux server. Am I missing an extension?

It works when I do:

$id = mysqli_fetch_row($query);
$id = $id[0];

Is there a way to enable the ability to combine the lines, without having to change everything?

Thanks.

PHP 5.4 has Function array dereferencing, eg foo()[0].

http://php.net/manual/en/migration54.new-features.php

< 5.4 does not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM