3v4l.org

run code in 300+ PHP versions simultaneously
<?PHP /* LookingGlass dgs-bootstraphtml.php */ define('dgs_void_tags', '<area><base><br><col><command><embed><hr><img><input><link><meta><param><source>'); define('dgs_CG_OPEN', '<div class="control-group">'); define('dgs_CG_CLOSE', '</div>'); define('dgs_HELP_OPEN', '<p class="help-block">'); define('dgs_HELP_CLOSE', '</p>'); $dgs_regNames = array(); function dgs_isVoidTag( $tagName ) { return (stripos(dgs_void_tags,'<'.$element.'>')!==false); } function dgs_nextRegNameID( $regName ) { global $dgs_regNames; if(isset($dgs_regNames[$regName])) { $dgs_regNames[$regName]++; } else { $dgs_regNames[$regName] = 0; } return $regName.$dgs_regNames[$regName]; } function dgs_attributes($OPTIONS) { $out = ''; foreach($OPTIONS as $parm => $val) { if(($parm[0]!='_')&&(!empty($val))) $out .= ' '.$parm.'="'.$val.'"'; } return $out; } function dgs_element($type, $text, $OPTIONS=array(), $print=true) { // create an element // $OPTIONS = array of option settings {including but not limited to:} // '_style' => {blank} | primary | success | info | warning | danger | inverse | link (string) // '_size' => large | {blank} | small | mini (string) // '_disabled' => true | false (boolean) // '_element' => a | button | input (string) // 'href' => {target URL} | # // 'type' => {blank} | button | input | submit // 'name' => {element name} // 'id' => {element id} // 'value' => {element value} $o = $OPTIONS; if(!isset($o['_element'])) return false; $element = strtolower($o['_element']); $class = (($type!='icon')?$type:''); $class .= ((!empty($o['_style']))?" $type-".$o['_style']:''); $class .= ((!empty($o['_size']))?" $type-".$o['_size']:''); $class .= (((!empty($o['_disabled']))&&($o['_disabled']==true))?' disabled':''); $class .= (((!empty($o['_inline']))&&($o['_inline']==true))?' inline':''); $class .= ((isset($o['class']))?' '.$o['class']:''); $class = trim($class); $o['class'] = $class; if($o['_disabled']==true)$o['disabled']='disabled'; $attr = dgs_attributes($o); $out = vsprintf('<%1$s %2$s>%3$s'.((!dgs_isVoidTag($element))?'</%1$s>':''), array( $element, $attr, $text, )); if(!empty($o['_help'])) $out.=dgs_HELP_OPEN.$o['_help'].dgs_HELP_CLOSE; if ($print==true) { echo $out; return true; } else { return $out; } } function dgs_button($text, $OPTIONS=array(), $print=true) { // create a button // $OPTIONS = array of option settings {including but not limited to:} // '_style' => {blank} | primary | info | success | warning | danger | inverse | link // '_size' => large | {blank} | small | mini $o = array( '_element' => 'button', 'type' => (empty($OPTIONS['type'])?'button':$OPTIONS['type']), ); return dgs_element('btn', $text, array_merge($OPTIONS, $o), $print); } function dgs_buttonA($text, $OPTIONS=array(), $print=true) { // create a button // $OPTIONS = array of option settings {including but not limited to:} // '_style' => {blank} | primary | info | success | warning | danger | inverse | link // '_size' => large | {blank} | small | mini $o = array( '_element' => 'a', 'href' => (empty($OPTIONS['href'])?'#':$OPTIONS['href']), ); return dgs_element('btn', $text, array_merge($OPTIONS, $o), $print); } function dgs_buttonI($text, $OPTIONS=array(), $print=true) { // create a button // $OPTIONS = array of option settings {including but not limited to:} // '_style' => {blank} | primary | info | success | warning | danger | inverse | link // '_size' => large | {blank} | small | mini $o = array( '_element' => 'input', 'type' => (empty($OPTIONS['type'])?'button':$OPTIONS['type']), 'value' => (empty($OPTIONS['value'])?((!empty($text))?$text:'Submit'):$OPTIONS['value']), ); return dgs_element('btn', '', array_merge($OPTIONS, $o), $print); } function dgs_checkbox($name, $label, $value="1", $checked=false, $OPTIONS=array(), $print=true) { // create a checkbox input // wrapped in CLASS GROUP unless _inline option is true. // $OPTIONS = array of option settings {including but not limited to:} // _inline = false | true (boolean) // _disabled = false | true (boolean) // _help = {help block text, shown after element} // id = {automatically assigned if left blank} if(empty($name)) return false; $o = array( 'checked' => (($checked)?'checked':''), 'value' => $value, 'id' => ((empty($OPTIONS['id']))?dgs_nextRegNameID($name):$OPTIONS['id']), '_element' => 'input', 'type' => 'checkbox', 'name' => $name, 'class' => '', '_help' => '', ); $class = "checkbox".((!empty($OPTIONS['class']))?' '.$OPTIONS['class']:'').(((!empty($OPTIONS['_inline']))&&($OPTIONS['_inline']==true))?' inline':''); $out = '<label class="'.$class.'">'.dgs_element('','', array_merge($OPTIONS, $o), false).'</label>'; if(!empty($OPTIONS['_help'])) $out.=dgs_HELP_OPEN.$OPTIONS['_help'].dgs_HELP_CLOSE; if ((empty($OPTIONS['_inline']))||($OPTIONS['_inline']!=true)) $out = dgs_CG_OPEN.$out.dgs_CG_CLOSE; if ($print) { echo $out; return true; } return $out; } function dgs_alert($text, $OPTIONS=array(), $print=true) { // create a dismissable alert box // $OPTIONS = array of option settings {including but not limited to:} // '_style' => {blank} | "error" | "success" | "info" $o = $OPTIONS; $o['_size'] = ((strlen($text) > 80)?'block':''); $o['_element'] = 'div'; $b = array( '_element' => 'button', 'type' => 'button', 'data-dismiss' => 'alert' ); $btn = dgs_element('close', '&times;', $b, false); return dgs_element('alert', $btn.$text, $o, $print ); } dgs_checkbox('mybox', "My Checkbox"); ?>

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)
8.3.60.0090.00916.75
8.3.50.0100.01222.12
8.3.40.0070.00718.84
8.3.30.0040.01119.22
8.3.20.0040.00420.39
8.3.10.0080.00021.96
8.3.00.0080.00019.51
8.2.180.0120.00618.54
8.2.170.0150.00022.96
8.2.160.0070.01420.65
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0030.00626.16
8.2.120.0060.00319.48
8.2.110.0060.00322.29
8.2.100.0120.00018.00
8.2.90.0040.00419.05
8.2.80.0030.00617.97
8.2.70.0040.00417.75
8.2.60.0050.00318.04
8.2.50.0000.01018.07
8.2.40.0000.00820.01
8.2.30.0040.00418.20
8.2.20.0050.00317.77
8.2.10.0040.00418.27
8.2.00.0050.00317.89
8.1.280.0160.00325.92
8.1.270.0060.00319.13
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0040.00422.14
8.1.230.0090.00317.77
8.1.220.0050.00317.77
8.1.210.0040.00418.77
8.1.200.0060.00317.48
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0060.00320.08
8.1.160.0000.00722.20
8.1.150.0030.00618.88
8.1.140.0080.00017.45
8.1.130.0030.00317.92
8.1.120.0040.00417.53
8.1.110.0000.00817.52
8.1.100.0000.00817.54
8.1.90.0000.00717.50
8.1.80.0000.00717.43
8.1.70.0000.00717.54
8.1.60.0060.00317.66
8.1.50.0000.00917.49
8.1.40.0000.00817.58
8.1.30.0040.00417.56
8.1.20.0080.00017.60
8.1.10.0090.00017.54
8.1.00.0040.00417.67
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0000.00718.57
8.0.270.0030.00617.25
8.0.260.0030.00317.36
8.0.250.0050.00217.14
8.0.240.0000.00717.01
8.0.230.0030.00317.12
8.0.220.0070.00016.91
8.0.210.0000.00716.93
8.0.200.0000.00817.06
8.0.190.0060.00617.16
8.0.180.0040.00417.02
8.0.170.0000.00817.01
8.0.160.0030.00516.98
8.0.150.0040.00417.09
8.0.140.0070.00016.90
8.0.130.0000.00713.46
8.0.120.0030.00516.86
8.0.110.0050.00316.95
8.0.100.0040.00417.00
8.0.90.0000.00817.02
8.0.80.0120.00617.08
8.0.70.0040.00417.06
8.0.60.0040.00416.82
8.0.50.0040.00416.88
8.0.30.0150.01017.13
8.0.20.0150.00717.41
8.0.10.0030.00517.16
8.0.00.0120.00516.86
7.4.330.0000.00615.15
7.4.320.0060.00016.73
7.4.300.0030.00316.73
7.4.290.0070.00216.61
7.4.280.0000.00816.70
7.4.270.0030.00316.60
7.4.260.0000.00816.55
7.4.250.0050.00216.65
7.4.240.0020.00516.69
7.4.230.0000.00716.59
7.4.220.0120.00616.63
7.4.210.0070.01016.70
7.4.200.0050.00216.39
7.4.160.0070.01016.50
7.4.150.0130.00617.40
7.4.140.0170.00517.86
7.4.130.0120.00916.55
7.4.120.0110.00816.57
7.4.110.0060.01216.57
7.4.100.0120.00616.77
7.4.90.0110.00716.52
7.4.80.0100.01019.39
7.4.70.0100.00716.78
7.4.60.0070.01016.64
7.4.50.0040.00416.49
7.4.40.0170.00016.60
7.4.30.0100.01316.50
7.4.00.0120.00414.85
7.3.330.0050.00013.36
7.3.320.0090.00313.51
7.3.310.0000.00716.40
7.3.300.0070.00016.50
7.3.290.0090.00716.48
7.3.280.0090.00716.52
7.3.270.0080.01217.40
7.3.260.0090.01516.75
7.3.250.0140.00716.51
7.3.240.0030.01516.63
7.3.230.0070.01616.72
7.3.210.0070.01516.45
7.3.200.0100.00719.39
7.3.190.0130.00316.39
7.3.180.0100.00616.55
7.3.170.0040.01216.78
7.3.160.0050.01116.67
7.3.10.0100.00316.71
7.3.00.0080.00816.69
7.2.330.0100.01016.79
7.2.320.0000.01616.98
7.2.310.0090.01216.88
7.2.300.0090.00916.45
7.2.290.0160.00616.95
7.2.130.0000.01316.82
7.2.120.0070.00716.55
7.2.110.0070.01017.05
7.2.100.0000.01316.86
7.2.90.0090.00616.86
7.2.80.0040.01416.92
7.2.70.0070.00716.66
7.2.60.0070.01016.81
7.2.50.0030.00716.84
7.2.40.0120.00316.75
7.2.30.0040.01116.78
7.2.20.0080.00416.89
7.2.10.0080.00516.84
7.2.00.0050.01318.26
7.1.250.0000.01115.58
7.1.100.0090.00318.23
7.1.70.0000.00717.00
7.1.60.0000.01117.25
7.1.50.0060.00617.03
7.1.40.0000.01516.49
7.1.30.0030.00916.65
7.1.20.0070.00716.81
7.1.10.0000.00916.57
7.1.00.0060.00616.68
7.0.200.0000.00716.69
7.0.190.0030.00716.82
7.0.180.0040.00416.57
7.0.170.0030.00716.57
7.0.160.0050.00516.43
7.0.150.0040.00716.22
7.0.140.0030.00716.41
7.0.130.0000.00816.52
7.0.120.0030.00516.60
7.0.110.0000.00716.21
7.0.100.0030.00516.28
7.0.90.0040.00416.34
7.0.80.0060.00316.46
7.0.70.0000.00916.29
7.0.60.0070.00416.36
7.0.50.0000.00916.49
7.0.40.0050.00516.13
7.0.30.0000.00816.13
7.0.20.0000.00816.13
7.0.10.0000.00916.13
7.0.00.0000.00816.13
5.6.300.0000.05020.96
5.6.290.0030.04920.88
5.6.280.0070.04020.89
5.6.270.0030.04021.05
5.6.260.0030.04321.02
5.6.250.0000.04321.13
5.6.240.0260.05220.89
5.6.230.0000.04420.85
5.6.220.0000.04320.91
5.6.210.0000.04320.66
5.6.200.0100.03421.01
5.6.190.0030.04720.84
5.6.180.0100.03520.86
5.6.170.0070.04020.98
5.6.160.0090.03521.07
5.6.150.0030.04620.77
5.6.140.0030.04320.98
5.6.130.0070.04021.08
5.6.120.0000.05020.86
5.6.110.0130.03321.07
5.6.100.0030.04220.85
5.6.90.0000.04620.84
5.6.80.0030.04920.25
5.6.70.0000.04620.36
5.6.60.0100.05120.36
5.6.50.0030.04720.23
5.6.40.0060.03620.44
5.6.30.0030.04920.44
5.6.20.0030.03920.20
5.6.10.0070.03720.23
5.6.00.0030.03920.34
5.5.380.0090.03817.63
5.5.370.0030.03917.42
5.5.360.0000.06817.46
5.5.350.0000.04217.62
5.5.340.0000.04618.07
5.5.330.0000.04218.06
5.5.320.0030.04318.10
5.5.310.0030.04118.14
5.5.300.0030.03918.09
5.5.290.0000.04818.11
5.5.280.0100.03518.14
5.5.270.0030.04618.09
5.5.260.0030.05218.06
5.5.250.0030.04517.92
5.5.240.0030.04217.41
5.5.230.0040.03917.40
5.5.220.0070.04017.39
5.5.210.0000.04317.50
5.5.200.0000.04317.48
5.5.190.0070.03917.50
5.5.180.0030.03817.48
5.5.160.0070.03317.26
5.5.150.0030.03917.45
5.5.140.0030.06117.25
5.5.130.0030.04017.35
5.5.120.0070.03717.40
5.5.110.0000.04117.47
5.5.100.0030.04017.30
5.5.90.0070.03717.40
5.5.80.0100.03717.40
5.5.70.0070.03617.36
5.5.60.0030.03817.14
5.5.50.0000.03917.35
5.5.40.0030.04117.14
5.5.30.0030.04217.26
5.5.20.0030.06617.26
5.5.10.0030.03616.99
5.5.00.0040.04217.34
5.4.450.0070.04919.30
5.4.440.0060.03919.23
5.4.430.0030.04019.29
5.4.420.0130.03219.22
5.4.410.0330.04319.32
5.4.400.0000.04418.89
5.4.390.0030.04219.02
5.4.380.0070.03919.13
5.4.370.0060.03619.20
5.4.360.0000.04718.89
5.4.350.0070.03918.88
5.4.340.0070.03619.01
5.4.320.0030.03719.15
5.4.310.0100.04919.18
5.4.300.0000.04418.92
5.4.290.0000.04019.02
5.4.280.0070.03419.00
5.4.270.0100.03219.13
5.4.260.0000.04419.11
5.4.250.0060.03819.20
5.4.240.0060.03519.20
5.4.230.0030.04219.05
5.4.220.0000.04419.23
5.4.210.0070.03619.11
5.4.200.0070.03418.89
5.4.190.0030.04718.89
5.4.180.0060.03518.99
5.4.170.0070.03618.88
5.4.160.0000.04719.11
5.4.150.0070.04119.16
5.4.140.0070.03316.61
5.4.130.0070.03916.57
5.4.120.0060.03616.58
5.4.110.0030.03716.71
5.4.100.0030.04516.64
5.4.90.0070.03016.83
5.4.80.0090.03416.66
5.4.70.0040.03916.50
5.4.60.0060.03816.70
5.4.50.0000.03916.49
5.4.40.0000.04116.73
5.4.30.0030.07516.50
5.4.20.0070.03116.72
5.4.10.0030.04016.50
5.4.00.0100.02716.13

preferences:
44.35 ms | 401 KiB | 5 Q