3v4l.org

run code in 300+ PHP versions simultaneously
<?php function HTMLStringify($arr, array $seen = array()) { if (is_array($arr)) { $seen[] = $arr; $html = '<ul>'; foreach ($arr as $key => $value) { $html .= '<li>' . $key; if (is_array($value)) { if (in_array($value, $seen, true)) { // Deal with recursion in your own way here $html .= ' [RECURSION]'; } else { $html .= HTMLStringify($value, $seen); } } elseif (is_numeric($value) || is_string($value) || is_null($value)) { $html .= ' = ' . $value; } else { $html .= ' [couldn\'t parse ' . gettype($value) . ']'; } $html .= '</li>'; } return $html . '</ul>'; } else { return null; } } $arr = array(1 => 'one', 2 => 'two'); $arr[3] = &$arr; echo HTMLStringify($arr);
Output for git.master, git.master_jit, rfc.property-hooks
<ul><li>1 = one</li><li>2 = two</li><li>3 [RECURSION]</li></ul>

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
26.21 ms | 405 KiB | 5 Q