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,'<'.$tagName.'>')!==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((!empty($o['_disabled']))&&($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", "1", true, array('_help' => 'This is my checkbox, there are none like it.')); ?>

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.0110.01116.88
8.3.50.0160.00522.00
8.3.40.0120.00318.76
8.3.30.0070.00719.07
8.3.20.0040.00420.20
8.3.10.0070.00021.73
8.3.00.0030.00619.23
8.2.180.0140.00718.41
8.2.170.0080.00822.96
8.2.160.0070.01020.47
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0050.00226.16
8.2.120.0040.00419.36
8.2.110.0060.00320.47
8.2.100.0080.00317.75
8.2.90.0050.00319.22
8.2.80.0030.00617.97
8.2.70.0060.00317.63
8.2.60.0060.00318.05
8.2.50.0070.00318.07
8.2.40.0000.00819.91
8.2.30.0040.00418.27
8.2.20.0000.00817.88
8.2.10.0030.00518.25
8.2.00.0060.00317.84
8.1.280.0140.00725.92
8.1.270.0040.00419.12
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0060.00621.16
8.1.230.0080.00417.91
8.1.220.0000.00917.79
8.1.210.0050.00518.77
8.1.200.0070.00317.60
8.1.190.0040.00417.35
8.1.180.0060.00318.10
8.1.170.0040.00420.32
8.1.160.0000.00722.13
8.1.150.0030.00518.87
8.1.140.0000.00717.52
8.1.130.0000.00717.78
8.1.120.0040.00417.38
8.1.110.0000.00717.39
8.1.100.0050.00317.52
8.1.90.0000.00817.57
8.1.80.0070.00017.52
8.1.70.0040.00417.46
8.1.60.0060.00317.65
8.1.50.0040.00417.50
8.1.40.0040.00417.50
8.1.30.0000.00917.56
8.1.20.0040.00417.72
8.1.10.0030.00617.68
8.1.00.0040.00417.55
8.0.300.0050.00318.77
8.0.290.0000.00716.88
8.0.280.0070.00018.51
8.0.270.0030.00617.26
8.0.260.0030.00317.38
8.0.250.0030.00517.04
8.0.240.0000.00717.08
8.0.230.0000.00717.04
8.0.220.0050.00216.98
8.0.210.0070.00016.95
8.0.200.0000.00716.92
8.0.190.0110.00017.04
8.0.180.0040.00416.91
8.0.170.0080.00017.01
8.0.160.0050.00317.04
8.0.150.0000.00716.90
8.0.140.0000.00816.94
8.0.130.0050.00313.37
8.0.120.0040.00416.98
8.0.110.0000.00717.04
8.0.100.0000.00816.76
8.0.90.0040.00416.93
8.0.80.0030.01416.98
8.0.70.0000.00716.94
8.0.60.0000.00916.85
8.0.50.0070.00017.04
8.0.30.0080.01117.04
8.0.20.0130.00717.40
8.0.10.0070.00016.90
8.0.00.0110.00916.88
7.4.330.0050.00015.03
7.4.320.0030.00316.52
7.4.300.0000.00716.54
7.4.290.0060.00316.55
7.4.280.0040.00416.58
7.4.270.0070.00016.71
7.4.260.0000.00716.65
7.4.250.0000.00716.56
7.4.240.0020.00516.67
7.4.230.0000.00716.43
7.4.220.0090.01116.46
7.4.210.0030.01216.48
7.4.200.0000.00716.77
7.4.160.0130.00316.52
7.4.150.0070.01117.40
7.4.140.0140.00817.86
7.4.130.0120.01016.67
7.4.120.0070.01116.60
7.4.110.0040.01416.52
7.4.100.0160.00316.55
7.4.90.0070.01016.43
7.4.80.0120.01219.39
7.4.70.0030.01316.76
7.4.60.0030.01316.75
7.4.50.0000.00516.43
7.4.40.0130.00416.63
7.4.30.0060.01216.45
7.4.10.0060.01214.94
7.4.00.0070.01015.00
7.3.330.0000.00513.24
7.3.320.0040.00813.32
7.3.310.0040.00416.50
7.3.300.0030.00316.39
7.3.290.0060.00916.46
7.3.280.0120.00816.45
7.3.270.0060.01317.40
7.3.260.0030.02016.65
7.3.250.0110.01116.60
7.3.240.0170.00016.46
7.3.230.0180.00616.45
7.3.210.0050.01516.65
7.3.200.0180.00419.39
7.3.190.0120.00516.73
7.3.180.0120.00416.55
7.3.170.0030.01316.64
7.3.160.0100.00616.77
7.3.130.0090.00614.92
7.3.120.0100.00714.87
7.3.110.0080.00814.99
7.3.100.0060.00814.91
7.3.90.0040.01014.86
7.3.80.0070.00915.10
7.3.70.0070.00814.80
7.3.60.0050.00914.89
7.3.50.0080.00714.78
7.3.40.0040.01115.00
7.3.30.0080.00514.95
7.3.20.0060.00616.74
7.3.10.0080.00516.59
7.3.00.0070.00616.53
7.2.330.0070.01016.88
7.2.320.0140.00316.87
7.2.310.0140.00416.90
7.2.300.0070.01016.79
7.2.290.0090.01016.95
7.2.260.0070.01114.95
7.2.250.0030.01415.33
7.2.240.0030.01514.83
7.2.230.0060.01115.06
7.2.220.0050.01215.13
7.2.210.0050.00915.10
7.2.200.0080.00515.24
7.2.190.0060.00915.10
7.2.180.0070.00715.04
7.2.170.0080.00615.21
7.2.160.0030.01315.20
7.2.150.0070.00317.01
7.2.140.0040.00717.09
7.2.130.0040.01316.96
7.2.120.0100.00616.99
7.2.110.0050.00917.00
7.2.100.0060.00616.89
7.2.90.0060.01016.79
7.2.80.0090.00916.90
7.2.70.0090.00617.04
7.2.60.0090.00316.96
7.2.50.0090.00617.06
7.2.40.0110.00516.72
7.2.30.0030.01116.80
7.2.20.0080.00616.95
7.2.10.0070.00916.98
7.2.00.0070.00717.85
7.1.330.0050.00815.94
7.1.320.0000.01415.90
7.1.310.0040.00915.88
7.1.300.0060.00815.84
7.1.290.0070.00715.91
7.1.280.0060.00615.89
7.1.270.0090.00515.77
7.1.260.0040.00715.96
7.1.250.0070.00515.77
7.1.240.0100.00315.79
7.1.230.0000.00915.73
7.1.220.0000.01415.89
7.1.210.0090.00615.84
7.1.200.0090.00615.68
7.1.190.0070.00715.96
7.1.180.0040.01415.91
7.1.170.0060.00915.79
7.1.160.0110.00415.77
7.1.150.0030.01015.68
7.1.140.0130.00015.78
7.1.130.0110.00415.87
7.1.120.0000.01415.84
7.1.110.0070.00415.70
7.1.100.0030.00916.98
7.1.90.0100.00315.99
7.1.80.0030.01115.89
7.1.70.0020.00616.63
7.1.60.0020.01617.61
7.1.50.0040.01316.48
7.1.40.0040.00915.66
7.1.30.0100.00615.75
7.1.20.0140.00015.60
7.1.10.0070.00315.86
7.1.00.0070.04019.18
7.0.330.0070.00715.45
7.0.320.0070.00915.41
7.0.310.0090.00315.61
7.0.300.0030.00615.10
7.0.290.0090.00615.33
7.0.280.0060.00615.39
7.0.270.0090.00315.46
7.0.260.0060.00315.17
7.0.250.0030.00615.43
7.0.240.0100.00315.37
7.0.230.0100.00715.14
7.0.220.0000.01315.48
7.0.210.0000.01515.39
7.0.200.0100.00715.25
7.0.190.0030.01015.52
7.0.180.0040.01115.47
7.0.170.0060.00915.33
7.0.160.0070.00715.45
7.0.150.0000.01215.48
7.0.140.0050.03918.73
7.0.130.0030.01015.60
7.0.120.0060.00315.49
7.0.110.0030.00915.33
7.0.100.0200.03917.82
7.0.90.0180.04417.83
7.0.80.0100.04317.60
7.0.70.0080.05117.66
7.0.60.0080.04317.77
7.0.50.0090.02618.00
7.0.40.0070.03916.81
7.0.30.0050.02716.84
7.0.20.0100.04316.66
7.0.10.0050.04316.73
7.0.00.0100.02316.68
5.6.400.0040.00814.42
5.6.390.0070.01014.64
5.6.380.0030.01014.83
5.6.370.0060.00614.44
5.6.360.0040.00414.68
5.6.350.0090.00614.63
5.6.340.0090.00314.30
5.6.330.0140.00414.47
5.6.320.0080.00414.23
5.6.310.0080.00614.84
5.6.300.0150.00014.70
5.6.290.0100.00614.74
5.6.280.0030.04317.64
5.6.270.0070.00714.63
5.6.260.0060.00614.63
5.6.250.0050.04417.59
5.6.240.0060.04617.70
5.6.230.0100.04217.69
5.6.220.0030.03417.67
5.6.210.0050.04217.63
5.6.200.0050.05117.75
5.6.190.0040.04717.81
5.6.180.0030.04517.80
5.6.170.0080.04217.78
5.6.160.0050.04717.65
5.6.150.0080.04617.73
5.6.140.0060.04417.77
5.6.130.0070.04417.79
5.6.120.0030.04417.80
5.6.110.0060.04317.86
5.6.100.0100.02017.85
5.6.90.0060.04717.86
5.6.80.0100.02317.33
5.6.70.0050.03117.51
5.6.60.0030.04917.54
5.6.50.0080.03517.39
5.6.40.0060.04617.36
5.6.30.0130.02817.46
5.6.20.0030.02817.54
5.6.10.0030.02717.41
5.6.00.0030.04017.53
5.5.380.0170.03217.49
5.5.370.0030.04217.46
5.5.360.0100.04617.49
5.5.350.0050.03817.48
5.5.340.0100.03617.73
5.5.330.0050.03917.81
5.5.320.0050.04517.63
5.5.310.0120.02517.79
5.5.300.0060.03417.75
5.5.290.0050.04517.64
5.5.280.0110.04517.69
5.5.270.0080.04817.62
5.5.260.0090.04517.70
5.5.250.0110.03917.50
5.5.240.0080.03717.43
5.5.230.0100.03917.27
5.5.220.0030.02817.42
5.5.210.0060.02617.45
5.5.200.0060.02617.32
5.5.190.0050.04317.13
5.5.180.0020.02917.25
5.5.170.0030.00614.32
5.5.160.0050.03017.28
5.5.150.0090.04017.32
5.5.140.0030.03517.24
5.5.130.0070.02617.26
5.5.120.0050.04517.34
5.5.110.0020.03517.32
5.5.100.0030.02917.33
5.5.90.0090.03517.30
5.5.80.0130.03517.24
5.5.70.0070.04317.17
5.5.60.0080.04317.36
5.5.50.0160.03117.10
5.5.40.0000.03717.30
5.5.30.0110.03317.28
5.5.20.0030.02817.38
5.5.10.0040.03017.28
5.5.00.0050.04717.41
5.4.450.0100.02215.64
5.4.440.0090.03515.49
5.4.430.0050.03815.52
5.4.420.0030.04515.66
5.4.410.0050.03115.54
5.4.400.0080.04015.48
5.4.390.0040.03915.47
5.4.380.0050.02315.49
5.4.370.0080.04515.45
5.4.360.0080.03015.32
5.4.350.0060.02015.46
5.4.340.0050.04315.45
5.4.330.0000.00611.76
5.4.320.0050.04115.35
5.4.310.0030.04715.45
5.4.300.0120.03315.48
5.4.290.0070.03915.38
5.4.280.0030.04315.47
5.4.270.0070.03815.44
5.4.260.0100.03015.40
5.4.250.0090.03715.49
5.4.240.0050.02715.44
5.4.230.0030.03715.40
5.4.220.0080.04215.45
5.4.210.0090.03815.46
5.4.200.0030.04615.42
5.4.190.0060.04315.48
5.4.180.0090.03815.46
5.4.170.0030.03515.33
5.4.160.0070.04015.42
5.4.150.0100.03315.44
5.4.140.0100.03814.08
5.4.130.0070.03914.09
5.4.120.0060.03014.07
5.4.110.0050.02614.13
5.4.100.0050.03114.13
5.4.90.0050.02514.16
5.4.80.0010.03814.14
5.4.70.0090.03214.12
5.4.60.0090.02814.14
5.4.50.0080.03614.15
5.4.40.0130.03514.13
5.4.30.0070.04014.06
5.4.20.0080.03314.09
5.4.10.0070.03814.03
5.4.00.0050.02313.80

preferences:
55.78 ms | 401 KiB | 5 Q