Access返回的数组在localhost上运行,但在服务器上运行

This works on localhost but not on server:

$x = preg_split("/#/", $val)[0];

I have wasted like 4 hours to notice that this was the problem. On the server no errors were shown and the php file was interpreted in a very strange way, if I had a die('ok') before this line it won't show anything.

$x = preg_split("/#/", $val);
$x = $x[0];

Works on server too.

And it's not about preg_split, it is the same with every function that returns an array.

You are running php 5.4 on localhost but php 5.3 (or some other) on the server

Function array dereferencing was added on php 5.4 see this