Not very strong in PHP so here is my question:
I am building a simple array to return as json, populating it with data from another array. The $eventarray may have the index gas or may not so I need to check for existing gas index and if it exist get the value if not populate with a default value.
How would I do that the most optimal way?
Again not that strong in PHP.
Here is the array:
$somearr = array(
"actiontaken"=>sprintf("%s", $eventarray['desc']),
"actionname" =>sprintf("%s", $eventarray['name']),
"type" =>sprintf("%s", $eventarray['type']),
"subtype" =>sprintf("%s", $eventarray['name']),
"min" =>sprintf("%s", $eventarray['min']),
"gas" =>sprintf("%s", $eventarray['gas']),
"playerId"=>$value['p'],
"name" =>$value2['name'],
"race" =>$value2['race']
);