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", "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.0070.00716.75
8.3.50.0140.00718.29
8.3.40.0110.00418.92
8.3.30.0140.00019.17
8.3.20.0050.00320.16
8.3.10.0050.00321.72
8.3.00.0090.00019.50
8.2.180.0130.00618.66
8.2.170.0100.00622.96
8.2.160.0100.01020.61
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0050.00320.95
8.2.110.0070.00722.16
8.2.100.0090.00317.88
8.2.90.0040.00419.34
8.2.80.0000.00817.97
8.2.70.0030.00617.50
8.2.60.0040.00418.05
8.2.50.0060.00318.07
8.2.40.0030.00519.75
8.2.30.0080.00018.20
8.2.20.0080.00017.77
8.2.10.0040.00418.21
8.2.00.0050.00317.80
8.1.270.0040.00419.00
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00622.22
8.1.230.0060.00617.79
8.1.220.0030.00517.90
8.1.210.0040.00418.77
8.1.200.0080.00317.47
8.1.190.0000.00817.48
8.1.180.0040.00418.10
8.1.170.0080.00020.25
8.1.160.0000.00722.06
8.1.150.0040.00418.96
8.1.140.0080.00017.48
8.1.130.0000.00717.84
8.1.120.0000.00717.46
8.1.110.0020.00517.46
8.1.100.0050.00217.53
8.1.90.0040.00417.57
8.1.80.0040.00417.43
8.1.70.0030.00517.47
8.1.60.0000.00817.73
8.1.50.0000.00817.60
8.1.40.0000.00817.61
8.1.30.0030.00517.71
8.1.20.0070.00017.69
8.1.10.0000.00817.54
8.1.00.0000.00717.48
8.0.300.0040.00418.77
8.0.290.0000.00716.88
8.0.280.0080.00018.43
8.0.270.0030.00316.91
8.0.260.0030.00317.22
8.0.250.0000.00717.07
8.0.240.0030.00317.11
8.0.230.0000.00717.16
8.0.220.0040.00416.94
8.0.210.0040.00417.04
8.0.200.0030.00317.03
8.0.190.0060.00317.13
8.0.180.0040.00417.04
8.0.170.0000.00917.10
8.0.160.0000.00816.94
8.0.150.0000.00716.88
8.0.140.0040.00417.06
8.0.130.0030.00613.43
8.0.120.0040.00417.02
8.0.110.0030.00517.02
8.0.100.0080.00017.05
8.0.90.0000.00716.93
8.0.80.0110.00717.08
8.0.70.0050.00317.11
8.0.60.0040.00416.99
8.0.50.0000.00717.10
8.0.30.0120.01117.01
8.0.20.0120.00817.40
8.0.10.0070.00017.12
8.0.00.0140.00816.87
7.4.330.0030.00315.12
7.4.320.0030.00316.65
7.4.300.0030.00316.63
7.4.290.0060.00316.67
7.4.280.0040.00416.58
7.4.270.0070.00016.70
7.4.260.0030.00516.60
7.4.250.0040.00416.62
7.4.240.0050.00216.69
7.4.230.0070.00016.49
7.4.220.0140.00516.59
7.4.210.0070.00716.46
7.4.200.0080.00016.77
7.4.160.0140.00316.53
7.4.150.0180.00617.40
7.4.140.0110.00817.86
7.4.130.0140.00616.57
7.4.120.0090.00816.60
7.4.110.0080.00916.58
7.4.100.0100.01316.55
7.4.90.0070.01116.61
7.4.80.0090.01519.39
7.4.70.0090.00916.59
7.4.60.0080.00916.54
7.4.50.0040.00416.71
7.4.40.0030.01316.73
7.4.30.0060.01516.71
7.4.00.0000.01815.26
7.3.330.0030.00313.40
7.3.320.0130.00013.46
7.3.310.0030.00316.57
7.3.300.0040.00416.54
7.3.290.0100.00716.52
7.3.280.0080.00716.53
7.3.270.0100.00717.40
7.3.260.0060.01216.70
7.3.250.0060.01316.62
7.3.240.0140.00316.66
7.3.230.0070.02416.68
7.3.210.0070.01016.62
7.3.200.0150.00619.39
7.3.190.0130.00916.56
7.3.180.0100.00716.76
7.3.170.0090.00916.61
7.3.160.0090.00916.48
7.3.10.0060.01116.87
7.3.00.0090.00916.60
7.2.330.0150.00616.91
7.2.320.0100.00716.64
7.2.310.0060.01216.73
7.2.300.0100.01316.89
7.2.290.0080.01716.68
7.2.130.0090.00916.70
7.2.120.0060.00916.88
7.2.110.0030.00716.68
7.2.100.0030.00916.91
7.2.90.0070.00717.09
7.2.80.0030.01317.12
7.2.70.0100.00016.79
7.2.60.0030.01316.77
7.2.50.0030.01317.01
7.2.40.0090.00317.11
7.2.30.0070.00717.14
7.2.20.0000.01016.88
7.2.10.0000.01016.72
7.2.00.0030.01218.26
7.1.250.0030.00915.92
7.1.100.0060.00618.21
7.1.70.0000.00717.08
7.1.60.0070.01119.50
7.1.50.0040.00816.68
7.1.00.0030.07322.33
7.0.200.0060.00615.20
7.0.140.0000.07021.91
7.0.100.0070.04720.04
7.0.90.0170.06719.96
7.0.80.0070.04720.05
7.0.70.0070.08019.98
7.0.60.0000.05019.98
7.0.50.0130.08320.34
7.0.40.0100.07320.07
7.0.30.0100.08320.14
7.0.20.0070.07320.10
7.0.10.0070.06720.09
7.0.00.0070.08020.04
5.6.280.0000.07720.92
5.6.250.0000.08720.82
5.6.240.0070.05320.64
5.6.230.0070.09020.71
5.6.220.0070.05320.65
5.6.210.0130.06720.54
5.6.200.0000.09021.08
5.6.190.0170.06321.01
5.6.180.0030.08021.01
5.6.170.0070.07721.10
5.6.160.0030.07321.09
5.6.150.0170.06721.19
5.6.140.0000.08721.19
5.6.130.0070.04021.18
5.6.120.0100.07321.13
5.6.110.0230.05321.20
5.6.100.0100.06321.10
5.6.90.0070.06321.14
5.6.80.0000.07020.35
5.6.70.0130.07020.38
5.6.60.0200.06320.39
5.6.50.0270.08020.61
5.6.40.0070.05020.36
5.6.30.0130.07320.52
5.6.20.0030.05720.51
5.6.10.0070.07020.54
5.6.00.0170.05020.35
5.5.380.0030.04720.37
5.5.370.0070.07320.50
5.5.360.0070.04720.41
5.5.350.0170.07020.42
5.5.340.0070.09020.84
5.5.330.0070.06720.94
5.5.320.0030.06320.81
5.5.310.0170.07020.82
5.5.300.0030.06720.82
5.5.290.0300.05720.82
5.5.280.0100.07720.87
5.5.270.0070.08720.85
5.5.260.0230.06020.77
5.5.250.0000.09320.77
5.5.240.0030.07320.27
5.5.230.0070.07320.23
5.5.220.0170.06020.16
5.5.210.0100.06320.19
5.5.200.0000.08320.05
5.5.190.0130.06720.30
5.5.180.0070.07320.18
5.5.160.0070.04720.05
5.5.150.0130.04020.27
5.5.140.0100.06020.23
5.5.130.0070.07320.22
5.5.120.0030.07720.26
5.5.110.0100.06720.27
5.5.100.0230.06720.12
5.5.90.0070.07319.99
5.5.80.0030.04720.20
5.5.70.0030.06720.04
5.5.60.0030.07720.11
5.5.50.0070.04019.95
5.5.40.0030.05020.20
5.5.30.0130.05320.09
5.5.20.0170.06320.12
5.5.10.0070.06720.09
5.5.00.0170.07020.14
5.4.450.0070.07019.27
5.4.440.0070.08019.51
5.4.430.0030.06019.23
5.4.420.0070.08019.51
5.4.410.0070.07319.24
5.4.400.0000.05019.13
5.4.390.0170.04018.91
5.4.380.0100.04718.85
5.4.370.0030.07019.04
5.4.360.0100.07019.24
5.4.350.0030.08018.88
5.4.340.0070.07718.85
5.4.320.0070.07719.05
5.4.310.0070.06319.05
5.4.300.0000.04318.90
5.4.290.0100.08319.23
5.4.280.0130.07018.92
5.4.270.0030.06319.14
5.4.260.0170.04019.05
5.4.250.0200.06319.05
5.4.240.0070.07719.09
5.4.230.0100.04019.13
5.4.220.0130.07719.18
5.4.210.0100.07019.20
5.4.200.0030.03719.12
5.4.190.0230.05719.15
5.4.180.0070.05018.85
5.4.170.0130.07019.11
5.4.160.0130.07319.21
5.4.150.0070.07719.02
5.4.140.0100.04016.55
5.4.130.0070.04016.42
5.4.120.0100.06316.29
5.4.110.0100.07316.40
5.4.100.0070.07016.41
5.4.90.0070.07716.38
5.4.80.0100.07016.43
5.4.70.0100.06316.36
5.4.60.0070.06716.47
5.4.50.0130.06316.39
5.4.40.0170.05716.54
5.4.30.0030.08016.34
5.4.20.0030.04316.39
5.4.10.0070.07316.50
5.4.00.0030.07015.95

preferences:
66.03 ms | 400 KiB | 5 Q