I have to get a table in my website. And have to get the data for this table from \"http://west.basketball.nl/db/json/stand.pl?szn_Naam=2014-2015&cmp_ID=373\" I\'ve trie
If you want recursive way:
public static function jsonToDebug($jsonText = '')
{
$arr = json_decode($jsonText, true);
$html = "";
if ($arr && is_array($arr)) {
$html .= self::_arrayToHtmlTableRecursive($arr);
}
return $html;
}
private static function _arrayToHtmlTableRecursive($arr) {
$str = "";
foreach ($arr as $key => $val) {
$str .= "";
$str .= "$key ";
$str .= "";
if (is_array($val)) {
if (!empty($val)) {
$str .= self::_arrayToHtmlTableRecursive($val);
}
} else {
$str .= "$val";
}
$str .= " ";
}
$str .= "
";
return $str;
}
Then call echo YourClass::jsonToDebug($jsonText)
;
My test on http://sandbox.onlinephpfunctions.com/