summaryrefslogtreecommitdiffstats
path: root/jsontohtml.php
diff options
context:
space:
mode:
authorAnton Luka Šijanec <sijanecantonluka@gmail.com>2020-01-03 00:35:44 +0100
committerAnton Luka Šijanec <sijanecantonluka@gmail.com>2020-01-03 00:35:44 +0100
commit3ae517757c61daa5e1a6700925af095b1ee4c5b5 (patch)
tree9143075340219a4a388f65ed20093b2dd7d73ef2 /jsontohtml.php
parentfirst commit (diff)
downloaditisclient-3ae517757c61daa5e1a6700925af095b1ee4c5b5.tar
itisclient-3ae517757c61daa5e1a6700925af095b1ee4c5b5.tar.gz
itisclient-3ae517757c61daa5e1a6700925af095b1ee4c5b5.tar.bz2
itisclient-3ae517757c61daa5e1a6700925af095b1ee4c5b5.tar.lz
itisclient-3ae517757c61daa5e1a6700925af095b1ee4c5b5.tar.xz
itisclient-3ae517757c61daa5e1a6700925af095b1ee4c5b5.tar.zst
itisclient-3ae517757c61daa5e1a6700925af095b1ee4c5b5.zip
Diffstat (limited to '')
-rwxr-xr-xjsontohtml.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/jsontohtml.php b/jsontohtml.php
new file mode 100755
index 0000000..6412c75
--- /dev/null
+++ b/jsontohtml.php
@@ -0,0 +1,8 @@
+#!/usr/bin/env php
+<?php
+class jsonHtml {
+public function jsonToDebug($jsonText = ''){ $arr = json_decode($jsonText, true); $html = ""; if ($arr && is_array($arr)) { $html .= self::_arrayToHtmlTableRecursive($arr); } return $html;}
+public function _arrayToHtmlTableRecursive($arr) { $str = "<style>table,td,tr,th{border:1px solid black;}</style><table><tbody>"; foreach ($arr as $key => $val) { $str .= "<tr>"; $str .= "<td>$key</td>"; $str .= "<td>"; if (is_array($val)) { if (!empty($val)) { $str .= self::_arrayToHtmlTableRecursive($val); } } else { $str .= "<strong>$val</strong>"; } $str .= "</td></tr>"; } $str .= "</tbody></table>"; return $str;}
+}
+file_put_contents($argv[2], jsonHtml::jsonToDebug(file_get_contents($argv[1])));
+?>