3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a= array ( 1 => 0, 2 => 1, 3 => 2, 4 => 3, 5 => 1, 6 => 0 ); class Menu extends CI_Model { public function __construct() { parent::__construct(); } public function menu_array($parent = 0) { $items = array(); $this->db->where('parent', $parent); $results = $this->db->get('os_menu')->result(); foreach($results as $result) { $child_array = $this->menu_array($result->id); if(sizeof($child_array) == 0) { array_push($items, $result); } else { array_push($items, array($result, $child_array)); } } return $items; } public function show_menu_array($array){ $output = '<ul>'; foreach ($array as $key => $mixedValue) { if (is_array($mixedValue)) { $output .= '<li>' . $this->show_menu_array($mixedValue) . '</li>'; } else { $output .= '<li>' . $mixedValue->name . '</li>'; } } $output .= '</ul>'; return $output; } $menu = new Menu(); $menu_array = $menu->menu_array(); echo $menu->show_menu_array($menu_array);

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)
5.4.290.0100.05112.51
5.4.280.0130.04212.40
5.4.270.0110.04412.41
5.4.260.0110.06712.41
5.4.250.0100.04712.40
5.4.240.0140.04312.40
5.4.230.0080.04812.40
5.4.220.0090.04712.39
5.4.210.0040.05312.40
5.4.200.0070.06412.39
5.4.190.0090.05112.39
5.4.180.0100.04712.39
5.4.170.0090.05312.40
5.4.160.0050.03812.39
5.4.150.0100.05912.39
5.4.140.0130.04112.09
5.4.130.0070.04712.06
5.4.120.0110.04512.03
5.4.110.0090.04212.03
5.4.100.0070.04512.03
5.4.90.0090.04812.02
5.4.80.0080.04312.03
5.4.70.0060.03712.02
5.4.60.0050.03612.03
5.4.50.0060.03612.02
5.4.40.0010.03912.01
5.4.30.0030.03912.00
5.4.20.0060.03712.00
5.4.10.0070.03812.00
5.4.00.0080.03811.50
5.3.280.0050.05612.70
5.3.270.0060.05112.72
5.3.260.0040.04312.72
5.3.250.0050.04412.72
5.3.240.0090.03812.72
5.3.230.0060.05212.70
5.3.220.0150.03412.68
5.3.210.0070.04212.68
5.3.200.0040.04212.68
5.3.190.0050.03912.68
5.3.180.0080.06212.68
5.3.170.0120.04012.67
5.3.160.0170.06512.68
5.3.150.0110.05612.67
5.3.140.0070.04012.66
5.3.130.0080.05312.66
5.3.120.0110.05112.66
5.3.110.0100.05212.66
5.3.100.0110.07912.14
5.3.90.0160.07512.11
5.3.80.0080.08012.11
5.3.70.0090.04712.11
5.3.60.0150.04712.09
5.3.50.0070.05912.04
5.3.40.0130.05712.04
5.3.30.0220.07812.00
5.3.20.0110.05111.78
5.3.10.0070.05011.75
5.3.00.0260.09911.73

preferences:
139.71 ms | 1394 KiB | 7 Q