I have a simple question. I have different returnvalues (jsons) but one class for all. if a value is not included in the json, i get an error message: Notice: Undefined index how do i get a query, but no error message. if the value is not assigned, for example -1 should be entered.
JSON:
Array
(
[number] => 2
[name] => Aachen-Rothe Erde
[mailingAddress] => Array
(
[city] => Aachen
[zipcode] => 52066
[street] => Beverstr. 48
)
[category] => 4
[priceCategory] => 4
[hasParking] => 1
[hasBicycleParking] => 1
[hasLocalPublicTransport] => 1
[hasPublicFacilities] =>
[hasLockerSystem] =>
[hasTaxiRank] => 1
[hasTravelNecessities] =>
[hasSteplessAccess] => yes
[hasMobilityService] => no
[hasWiFi] =>
[hasTravelCenter] =>
[hasRailwayMission] =>
[hasDBLounge] =>
[hasLostAndFound] =>
[hasCarRental] =>
[federalState] => Nordrhein-Westfalen
)
PHP:
$return = json_decode($file, true);
$back = array();
$array = array();
for ($i = 0; $i < 100; $i++) {
$array[] = $return['result'][$i];
//$back[] = new GetMatchesForTrainstationSearch($array[$i]);
}
echo $input['something that is not in json'];