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.00917.00
8.3.50.0090.01221.99
8.3.40.0120.00318.84
8.3.30.0110.00419.21
8.3.20.0070.00020.45
8.3.10.0040.00421.86
8.3.00.0040.00419.50
8.2.180.0150.00018.66
8.2.170.0180.00422.96
8.2.160.0100.01020.56
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0040.00419.63
8.2.110.0030.00620.97
8.2.100.0090.00317.88
8.2.90.0080.00019.33
8.2.80.0040.00417.97
8.2.70.0060.00317.75
8.2.60.0080.00018.17
8.2.50.0000.00818.07
8.2.40.0040.00420.01
8.2.30.0000.00918.28
8.2.20.0030.00517.93
8.2.10.0000.00818.28
8.2.00.0050.00318.00
8.1.280.0150.00025.92
8.1.270.0060.00319.03
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0070.00417.58
8.1.230.0040.00717.88
8.1.220.0030.00617.91
8.1.210.0030.00718.77
8.1.200.0030.00617.48
8.1.190.0030.00617.35
8.1.180.0030.00618.10
8.1.170.0000.00820.36
8.1.160.0000.00722.13
8.1.150.0000.00718.82
8.1.140.0000.00817.53
8.1.130.0040.00417.49
8.1.120.0040.00417.40
8.1.110.0080.00017.54
8.1.100.0050.00217.42
8.1.90.0000.00717.46
8.1.80.0060.00317.52
8.1.70.0000.00717.38
8.1.60.0090.00017.70
8.1.50.0040.00417.59
8.1.40.0030.00617.58
8.1.30.0000.00817.73
8.1.20.0000.00817.64
8.1.10.0040.00417.63
8.1.00.0000.00817.63
8.0.300.0000.00818.77
8.0.290.0080.00016.88
8.0.280.0070.00018.45
8.0.270.0080.00317.21
8.0.260.0000.00816.87
8.0.250.0000.00716.98
8.0.240.0000.00717.05
8.0.230.0070.00017.01
8.0.220.0000.00717.00
8.0.210.0030.00317.03
8.0.200.0070.00017.03
8.0.190.0030.00617.00
8.0.180.0050.00216.96
8.0.170.0080.00017.07
8.0.160.0030.00516.95
8.0.150.0040.00417.00
8.0.140.0070.00016.97
8.0.130.0080.00013.44
8.0.120.0050.00316.85
8.0.110.0040.00416.95
8.0.100.0070.00016.91
8.0.90.0050.00216.95
8.0.80.0040.01917.04
8.0.70.0040.00416.87
8.0.60.0020.00517.11
8.0.50.0070.00017.05
8.0.30.0150.00517.38
8.0.20.0090.01317.40
8.0.10.0030.00516.96
8.0.00.0140.00516.94
7.4.330.0000.00615.09
7.4.320.0000.00616.74
7.4.300.0000.00716.73
7.4.290.0000.01016.52
7.4.280.0050.00316.58
7.4.270.0050.00316.64
7.4.260.0040.00416.72
7.4.250.0040.00416.54
7.4.240.0030.00516.64
7.4.230.0070.00016.52
7.4.220.0120.01216.63
7.4.210.0130.00716.77
7.4.200.0040.00416.78
7.4.160.0080.00816.64
7.4.150.0210.00317.40
7.4.140.0100.01317.86
7.4.130.0130.01016.74
7.4.120.0160.00216.65
7.4.110.0070.01016.66
7.4.100.0160.00716.70
7.4.90.0060.01316.74
7.4.80.0030.01519.39
7.4.70.0070.01016.85
7.4.60.0080.00916.72
7.4.50.0020.00216.64
7.4.40.0090.00816.46
7.4.30.0070.01516.67
7.4.10.0030.01415.13
7.4.00.0070.01015.10
7.3.330.0000.00613.34
7.3.320.0060.00613.50
7.3.310.0020.00516.30
7.3.300.0030.00316.57
7.3.290.0080.00816.52
7.3.280.0050.01316.47
7.3.270.0040.01617.40
7.3.260.0100.01516.61
7.3.250.0100.01116.54
7.3.240.0070.01016.48
7.3.230.0100.01316.64
7.3.210.0130.01016.75
7.3.200.0070.01019.39
7.3.190.0070.01016.53
7.3.180.0060.00916.62
7.3.170.0030.01716.59
7.3.160.0130.00316.62
7.3.130.0050.01214.95
7.3.120.0050.01314.97
7.3.110.0050.01014.99
7.3.100.0090.00714.88
7.3.90.0020.01014.88
7.3.80.0050.00514.98
7.3.70.0070.00615.01
7.3.60.0070.00714.80
7.3.50.0020.01114.71
7.3.40.0020.00914.99
7.3.30.0040.01014.98
7.3.20.0050.00916.86
7.3.10.0050.01216.69
7.3.00.0060.00716.78
7.2.330.0000.02016.79
7.2.320.0100.00716.71
7.2.310.0090.00916.88
7.2.300.0080.01616.89
7.2.290.0150.00616.67
7.2.260.0090.00815.23
7.2.250.0080.01015.18
7.2.240.0100.00715.09
7.2.230.0090.00815.16
7.2.220.0090.01015.16
7.2.210.0070.00515.23
7.2.200.0040.01015.20
7.2.190.0040.01115.02
7.2.180.0070.00815.09
7.2.170.0070.00515.27
7.2.160.0080.00515.10
7.2.150.0090.00816.79
7.2.140.0070.01016.92
7.2.130.0060.00716.86
7.2.120.0090.00616.95
7.2.110.0080.00717.03
7.2.100.0040.00716.88
7.2.90.0060.00916.97
7.2.80.0060.00916.94
7.2.70.0110.00416.87
7.2.60.0060.00816.80
7.2.50.0070.00516.88
7.2.40.0060.00817.09
7.2.30.0060.00817.07
7.2.20.0050.00917.08
7.2.10.0050.01016.88
7.2.00.0040.01017.64
7.1.330.0070.00815.76
7.1.320.0050.00915.83
7.1.310.0040.00615.85
7.1.300.0010.01015.87
7.1.290.0060.00615.78
7.1.280.0040.01015.77
7.1.270.0080.00615.84
7.1.260.0040.01215.88
7.1.250.0080.00615.81
7.1.240.0070.00715.88
7.1.230.0050.01115.76
7.1.220.0040.00715.70
7.1.210.0070.00315.75
7.1.200.0020.01115.72
7.1.190.0070.00815.86
7.1.180.0070.00715.74
7.1.170.0050.00915.82
7.1.160.0040.01015.77
7.1.150.0050.01015.71
7.1.140.0050.00915.75
7.1.130.0030.00915.83
7.1.120.0080.00715.74
7.1.110.0050.00615.78
7.1.100.0050.00916.31
7.1.90.0040.00915.79
7.1.80.0050.00815.83
7.1.70.0040.00816.11
7.1.60.0030.01216.74
7.1.50.0040.01116.13
7.1.40.0040.00815.92
7.1.30.0060.00715.85
7.1.20.0030.01015.74
7.1.10.0040.00915.76
7.1.00.0080.02117.50
7.0.330.0060.00615.29
7.0.320.0020.01015.36
7.0.310.0090.00715.30
7.0.300.0040.00815.22
7.0.290.0030.01115.39
7.0.280.0020.01015.30
7.0.270.0070.00615.46
7.0.260.0030.00815.38
7.0.250.0040.00915.38
7.0.240.0100.00315.46
7.0.230.0040.00515.38
7.0.220.0090.00615.40
7.0.210.0060.00615.40
7.0.200.0080.00715.38
7.0.190.0070.00715.56
7.0.180.0070.00615.45
7.0.170.0040.00715.37
7.0.160.0050.01015.30
7.0.150.0030.00815.50
7.0.140.0060.02317.07
7.0.130.0010.01515.19
7.0.120.0070.00715.45
7.0.110.0030.00815.27
7.0.100.0070.01916.54
7.0.90.0070.02616.57
7.0.80.0110.02316.65
7.0.70.0070.02216.62
7.0.60.0100.02216.62
7.0.50.0080.02516.79
7.0.40.0070.02715.05
7.0.30.0030.02015.06
7.0.20.0060.02515.01
7.0.10.0070.02115.03
7.0.00.0120.02215.10
5.6.400.0050.00814.51
5.6.390.0050.00614.63
5.6.380.0020.00914.44
5.6.370.0080.00814.60
5.6.360.0020.01114.45
5.6.350.0060.00814.59
5.6.340.0050.00814.51
5.6.330.0070.00514.62
5.6.320.0090.00314.59
5.6.310.0100.00414.50
5.6.300.0030.00914.34
5.6.290.0050.00814.49
5.6.280.0120.01816.16
5.6.270.0080.00614.53
5.6.260.0100.00414.45
5.6.250.0060.02416.13
5.6.240.0070.01916.02
5.6.230.0060.02416.22
5.6.220.0060.02716.09
5.6.210.0030.02116.15
5.6.200.0080.02416.12
5.6.190.0060.02616.26
5.6.180.0100.02416.17
5.6.170.0070.02616.19
5.6.160.0060.02116.05
5.6.150.0080.02716.03
5.6.140.0090.02416.23
5.6.130.0060.02916.09
5.6.120.0040.02816.27
5.6.110.0080.02215.98
5.6.100.0070.02216.11
5.6.90.0080.02416.32
5.6.80.0070.01515.94
5.6.70.0090.02115.93
5.6.60.0050.02015.86
5.6.50.0050.02916.06
5.6.40.0100.01515.89
5.6.30.0080.02515.88
5.6.20.0090.02515.81
5.6.10.0040.01916.06
5.6.00.0050.02815.80
5.5.380.0070.01715.94
5.5.370.0100.02215.82
5.5.360.0090.02215.90
5.5.350.0080.02615.89
5.5.340.0080.02316.04
5.5.330.0050.01915.96
5.5.320.0030.01816.02
5.5.310.0080.01816.01
5.5.300.0070.02716.05
5.5.290.0040.02116.03
5.5.280.0070.02915.96
5.5.270.0050.02616.04
5.5.260.0050.02115.94
5.5.250.0040.02015.97
5.5.240.0060.02615.86
5.5.230.0080.02215.66
5.5.220.0070.02815.78
5.5.210.0120.01515.80
5.5.200.0050.02515.75
5.5.190.0070.02215.74
5.5.180.0050.02215.84
5.5.170.0030.01414.42
5.5.160.0070.02515.92
5.5.150.0070.02215.88
5.5.140.0060.02015.81
5.5.130.0070.02215.91
5.5.120.0070.02515.80
5.5.110.0080.02215.77
5.5.100.0040.02115.82
5.5.90.0070.02515.77
5.5.80.0100.02015.85
5.5.70.0050.01715.78
5.5.60.0040.01815.81
5.5.50.0060.02415.73
5.5.40.0060.02415.68
5.5.30.0070.02215.78
5.5.20.0040.02815.78
5.5.10.0060.02015.71
5.5.00.0080.01915.67
5.4.450.0080.02213.36
5.4.440.0070.01513.44
5.4.430.0080.01213.49
5.4.420.0040.01813.37
5.4.410.0050.01413.40
5.4.400.0060.02113.27
5.4.390.0060.02213.39
5.4.380.0080.02213.32
5.4.370.0060.02013.31
5.4.360.0090.02113.39
5.4.350.0050.01613.27
5.4.340.0050.02013.33
5.4.330.0030.00411.44
5.4.320.0030.01913.25
5.4.310.0040.01613.27
5.4.300.0010.02513.36
5.4.290.0030.02213.28
5.4.280.0050.02013.36
5.4.270.0070.01713.34
5.4.260.0030.02513.30
5.4.250.0020.02013.36
5.4.240.0060.02413.43
5.4.230.0020.02713.42
5.4.220.0030.02713.39
5.4.210.0020.01813.32
5.4.200.0050.01513.33
5.4.190.0080.01913.34
5.4.180.0060.02213.38
5.4.170.0060.02213.45
5.4.160.0060.02113.37
5.4.150.0070.01913.43
5.4.140.0050.02212.73
5.4.130.0030.01812.66
5.4.120.0030.01812.67
5.4.110.0020.01812.69
5.4.100.0060.01912.72
5.4.90.0050.02512.66
5.4.80.0060.02012.70
5.4.70.0050.01712.67
5.4.60.0040.01512.66
5.4.50.0040.02012.61
5.4.40.0050.01912.69
5.4.30.0060.01212.64
5.4.20.0060.01912.68
5.4.10.0030.02212.70
5.4.00.0030.02012.59

preferences:
61.7 ms | 401 KiB | 5 Q