@ 2017-07-04T13:41:05Z <?php
<?php
$paths = array(
'about/contact/' => 'Contact Us',
'about/contact/form/' => 'Contact Form',
'about/history/' => 'Our History',
'about/staff/' => 'Our Staff',
'about/staff/bobjones/' => 'Bob',
'about/staff/sallymae/' => 'Sally',
'products/' => 'All Products',
'products/gifts/' => 'Gift Ideas!',
'products/widgets/' => 'Widgets'
);
function build_tree($path_list) {
$path_tree = array();
foreach ($path_list as $path => $title) {
$list = explode('/', trim($path, '/'));
$last_dir = &$path_tree;
foreach ($list as $dir) {
$last_dir =& $last_dir[$dir];
}
$last_dir['__title'] = $title;
}
return $path_tree;
}
function build_list($tree, $prefix = '') {
$ul = '';
foreach ($tree as $key => $value) {
$li = '';
if (is_array($value)) {
if (array_key_exists('__title', $value)) {
$li .= "$prefix$key/ <a href=\"/$prefix$key/\">${value['__title']}</a>";
} else {
$li .= "$prefix$key/";
}
$li .= build_list($value, "$prefix$key/");
$ul .= strlen($li) ? "<li>$li</li>" : '';
}
}
return strlen($ul) ? "<ul>$ul</ul>" : '';
}
$tree = build_tree($paths);
$list = build_list($tree);
echo $list;
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 7.1.6 0.013 0.013 35.15 7.1.5 0.027 0.007 34.78 7.1.4 0.017 0.010 34.27 7.1.3 0.013 0.010 34.35 7.1.2 0.013 0.010 34.54 7.1.1 0.000 0.013 16.25 7.1.0 0.000 0.013 16.49 7.0.20 0.003 0.007 16.45 7.0.19 0.003 0.007 16.45 7.0.18 0.003 0.007 16.14 7.0.17 0.000 0.010 16.25 7.0.16 0.003 0.007 16.02 7.0.15 0.000 0.010 16.13 7.0.14 0.003 0.007 16.05 7.0.13 0.007 0.003 16.38 7.0.12 0.000 0.010 16.27 7.0.11 0.000 0.010 15.94 7.0.10 0.003 0.010 16.09 7.0.9 0.003 0.007 16.37 7.0.8 0.007 0.007 16.13 7.0.7 0.000 0.010 16.05 7.0.6 0.003 0.013 16.11 7.0.5 0.000 0.010 16.21 7.0.4 0.000 0.010 16.54 7.0.3 0.003 0.007 16.50 7.0.2 0.000 0.010 16.24 7.0.1 0.007 0.003 16.21 7.0.0 0.003 0.007 16.39
preferences:dark mode live preview
141.94 ms | 1394 KiB | 7 Q