I am developing on a server that only supports PHP 5.3.3. I am trying to use Elasticsearch, but it gives me this error: Parse error: syntax error, unexpected '[' in C:\wamp\www\test3\es.php on line 6
The code works perfectly on PHP 5.6+ Here's the code:
<?php
require_once 'vendor/autoload.php';
use Elasticsearch\ClientBuilder;
/*Build connection*/
$hosts = [ //<<<<---- Line 6
'xx.x.xxx.xxx', // IP + Port
];
$es = ClientBuilder::create() // Instantiate a new ClientBuilder
->setHosts($hosts) // Set the hosts
->build(); // Build the client object
?>
It is not recognizing the bracket where it says $hosts = [
Is there a way I can make this code run on PHP 5.3.3?