I need to make an array of locations arrays, it must look like this
$relevanceKeys = array( \'locations\' => array( array( \'longitud
Since you're only needing to push elements to the array, you can simply use the [] struct as follows:
[]
while ($row = $result->fetch_object()) { $relevanceKeys['locations'][] = array ( 'longitude' => $row->longitude, 'latitude' => $row->latitude ); }