I have two servers. They both run php 5.3.3. This code runs on one server and returns a syntax error from another. Is there a php ini setting that affects this behavior? I cannot find anything related in the PHP documentation, but I can search in the wrong place.
Server 1
> php -v PHP 5.3.3 (cli) (built: Sep 23 2010 14:15:16) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Xdebug v2.0.3, Copyright (c) 2002-2007, by Derick Rethans php > echo explode(" ", " foo ")[1]; foo
Server 2
> php -v PHP 5.3.3 (cli) (built: Jan 31 2011 15:57:29) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies php > echo explode(" ", " foo ")[1]; Parse error: syntax error, unexpected '[', expecting ',' or ';' in php shell code on line 1
Another idea: PHP on both servers is compiled to order, so it can also be a different compilation flag.
php xdebug configuration
Kyle wiens
source share