/**
* Funtion make a recursive decode for a JSON an convert every object in array
* @param type $json
* @return boolean
*/
function decode($json)
{
if ((is_string($json)) && (!$this->isJSON($json)))
{
return FALSE;
}
else
{
$new = [];
if ($this->isJSON($json))
{
$json = (array) json_decode($json);
}
foreach ($json as $k => $v)
{
if (($this->isJSON($v)) || (is_array($v)) || (is_object($v)))
{
$new[$k] = $this->decode($v); //RECURSION
}
else
{
$new[$k] = ($v == 'null') ? "" : $this->dateTimeFormat($v);
}
}
return $new;
}
}
Tutorials