note 95462 deleted from function.json-encode by danbrown
| From: | danbrown@php.net | Date: | Mon, 04 Jan 2010 16:07:25 +0000 |
| Subject: | note 95462 deleted from function.json-encode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164622@lists.php.net to get a copy of this message | ||
Note Submitter: rene
----
(continued)
JavaScript:
----------------------
function debugPrintCollapsible (debugPrintCommand) {
var d = eval('(' + debugPrintCommand.data + ')');
var t = debugPrintCommand.title;
var id = debugPrintCommand.id;
var html = '';
html+= '<table class="debug" style="width:100%"
border="1">';
html+= '<tr><th
colspan="999">'+t+'</th></tr>';
html+= debugPrintVariable (d);
html+= '</table>';
document.getElementById(id).innerHTML = html;
}
function debugPrintVariable (v) {
var tv = typeof (v);
var html = '';
switch (tv) {
case 'boolean':
html+= '<tr>';
html+= '<td>';
html+= (v?'true':'false');
html+= '</td>';
html+= '</tr>';
break;
case 'number':
case 'string':
html+= '<tr>';
html+= '<td>';
html+= v;
html+= '</td>';
html+= '</tr>';
break;
case 'array':
case 'object':
html+= '<tr><th
class="debugArrayKey">Key</th><th>Value</th></tr>';
for (n in v) {
html += '<tr><td
class="debugArrayKey">'+n+'</td><td><table
class="debug" style="width:100%"
border="1">'+debugPrintVariable(v[n])+'</table></td></tr>';
}
break;
default:
html+= '<tr>';
html+= '<td>UNKNOWN TYPE '+typeof(v)+' ';
html+= '</td>';
html+= '</tr>';
break;
}
return html;
}