3v4l.org

run code in 300+ PHP versions simultaneously
<?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; ?>

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).

VersionSystem time (s)User time (s)Memory (MiB)
7.1.60.0130.01335.15
7.1.50.0270.00734.78
7.1.40.0170.01034.27
7.1.30.0130.01034.35
7.1.20.0130.01034.54
7.1.10.0000.01316.25
7.1.00.0000.01316.49
7.0.200.0030.00716.45
7.0.190.0030.00716.45
7.0.180.0030.00716.14
7.0.170.0000.01016.25
7.0.160.0030.00716.02
7.0.150.0000.01016.13
7.0.140.0030.00716.05
7.0.130.0070.00316.38
7.0.120.0000.01016.27
7.0.110.0000.01015.94
7.0.100.0030.01016.09
7.0.90.0030.00716.37
7.0.80.0070.00716.13
7.0.70.0000.01016.05
7.0.60.0030.01316.11
7.0.50.0000.01016.21
7.0.40.0000.01016.54
7.0.30.0030.00716.50
7.0.20.0000.01016.24
7.0.10.0070.00316.21
7.0.00.0030.00716.39

preferences:
141.94 ms | 1394 KiB | 7 Q