<?php
error_reporting(-1);
ini_set('display_errors', 'On');
header("Content-Type: application/json; charset=utf-8", true);
class shop {
public $denominazione;
public $indirizzo;
public $civico;
public $cap;
public $tel;
public $lat;
public $lon;
}
$locale1 = new shop();
$locale1->denominazione = 'Husker Dù';
$locale1->indirizzo = 'Via dei Reti';
$locale1->civico = 22/24;
$locale1->cap = 00185;
$locale1->tel = 3289546693;
$locale1->lat = 41.89932;
$locale1->lon = 12.51777;
$loadLocali = array($locale1);
$res = $loadLocali;
try{
if ( count($res) >=1){
echo json_encode($res);
}
else{
$error = json_last_error();
throw new Exception($error);
}
}
catch (Exception $e) {
echo 'We"re gonna have a problem here: ', $e->getMessage(), "\n";
var_dump($error === JSON_ERROR_UTF8);
var_dump($error === JSON_ERROR_DEPTH);
var_dump($error === JSON_ERROR_STATE_MISMATCH);
}
?>
- Output for 7.0.0 - 7.0.4
- Parse error: Invalid numeric literal in /in/qqgmu on line 20
Process exited with code 255. - Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
- [{"denominazione":"Husker D\u00f9","indirizzo":"Via dei Reti","civico":0.91666666666667,"cap":1,"tel":3289546693,"lat":41.89932,"lon":12.51777}]
preferences:
141.21 ms | 1432 KiB | 7 Q