Allora, il codice PHP incriminato è questo, che usa la libreria solr-php-client reperibile sul web
Codice PHP:
$response = $solr->search( $query, $offset, $limit, "hl=true" );
$v = $response->highlighting;
$array = (array) $v;
print_r($array);
$a = $v[2]->title[0]; //riga 76
print_r($a);
La prima print_r stampa
codice:
Array ( [2] => stdClass Object ( [title] => Array ( [0] => Il centro del mondo ) ) [21] => stdClass Object ( [title] => Array ( [0] => Il mio nome è mai più ) ) )
mentre la seconda, suggerita bionicoz, stampa
codice:
Fatal error: Cannot use object of type stdClass as array in C:\EasyPHP-5.3.2\www\search.php on line 76