| Server IP : 37.9.174.138 / Your IP : 216.73.216.117 Web Server : Apache System : Linux vps6.backend.sk 6.12.100+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.100-1 (2026-07-30) x86_64 User : ftpuser ( 1001) PHP Version : 8.4.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/html/ttjs.cz/muj/ |
Upload File : |
<?php
$json = '{
"code": 0,
"status": "200 OK",
"message": "Success.",
"data": {
"lang": "sk",
"enums": []
}
}';
$decoded = json_decode($json);
$fixedRules = array(
"state" => "</font><font color='green'>ENUM</font> (ACTIVE | DISABLED | ARCHIVED | DELETED)",
"description" => "<font color='green'>STRING</font>"
);
processJson($decoded, 0, $fixedRules);
function processJson($data, $step = 0, $fixedRules) {
if ($step === 0) {
for ($i = 0; $i < $step + 1; $i++) {
echo "  ";
}
}
if (is_array($data)) {
echo "[<br>";
} else {
echo "{<br>";
}
echo "\n";
foreach ($data as $key => $val) {
for ($i = 0; $i < $step + 2; $i++) {
echo "  ";
}
if (is_object($val) || is_array($val)) {
echo "<font color='blue'>";
if (!is_numeric($key)) {
echo $key . ": ";
}
echo "</font>";
processJson($val, $step + 1, $fixedRules);
} else {
echo "<font color='blue'>";
if (!is_numeric($key)) {
echo $key;
echo ": ";
}
echo "</font>";
if (key_exists($key, $fixedRules)) {
echo $fixedRules[$key];
} else {
echo "<font color='green'>";
if (is_numeric($val)) {
echo "INTEGER";
} else if (is_date($val)) {
echo "DATETIME";
} else {
echo strtoupper(gettype($val));
}
echo "</font>";
}
echo "\n";
echo "<br>";
echo "\n";
}
}
for ($i = 0; $i < $step + 1; $i++) {
echo "  ";
}
if (is_array($data)) {
echo "]<br>";
} else {
echo "}<br>";
}
}
function is_date($x) {
if ($x === true || $x === false) {
return false;
}
return (date('Y-m-d H:i:s', strtotime($x)) == $x);
}