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' => '', '_inline' => false, ); $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.0120.00316.75
8.3.50.0090.01222.10
8.3.40.0060.01618.98
8.3.30.0150.00019.09
8.3.20.0000.00820.38
8.3.10.0070.00021.90
8.3.00.0000.00819.38
8.2.180.0110.01118.08
8.2.170.0140.00722.96
8.2.160.0130.00320.70
8.2.150.0000.00924.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0030.00619.48
8.2.110.0000.01119.39
8.2.100.0040.00818.00
8.2.90.0030.00619.43
8.2.80.0030.00617.97
8.2.70.0030.00617.63
8.2.60.0050.00318.02
8.2.50.0090.00218.07
8.2.40.0040.00418.47
8.2.30.0080.00318.21
8.2.20.0030.00517.71
8.2.10.0060.00318.12
8.2.00.0040.00417.78
8.1.280.0070.00725.92
8.1.270.0090.00018.99
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0000.01022.38
8.1.230.0070.00417.78
8.1.220.0080.00017.91
8.1.210.0040.00418.77
8.1.200.0030.00617.36
8.1.190.0030.00617.47
8.1.180.0030.00518.10
8.1.170.0040.00420.42
8.1.160.0000.00722.09
8.1.150.0070.00019.02
8.1.140.0000.00917.45
8.1.130.0030.00317.96
8.1.120.0000.00717.59
8.1.110.0000.00817.57
8.1.100.0040.00417.48
8.1.90.0040.00417.55
8.1.80.0040.00417.39
8.1.70.0070.00017.44
8.1.60.0000.00817.71
8.1.50.0000.00717.51
8.1.40.0040.00417.54
8.1.30.0000.00917.72
8.1.20.0030.00617.68
8.1.10.0040.00417.62
8.1.00.0030.00617.58
8.0.300.0040.00418.77
8.0.290.0000.00716.88
8.0.280.0050.00218.45
8.0.270.0030.00617.27
8.0.260.0000.00817.39
8.0.250.0000.00716.89
8.0.240.0040.00417.00
8.0.230.0000.00716.92
8.0.220.0070.00016.94
8.0.210.0040.00416.89
8.0.200.0030.00316.95
8.0.190.0070.00317.08
8.0.180.0030.00516.84
8.0.170.0070.00016.88
8.0.160.0050.00316.97
8.0.150.0000.00717.02
8.0.140.0000.00816.77
8.0.130.0090.00013.41
8.0.120.0050.00316.93
8.0.110.0040.00416.89
8.0.100.0040.00416.98
8.0.90.0040.00416.97
8.0.80.0120.00917.00
8.0.70.0040.00416.80
8.0.60.0000.00816.80
8.0.50.0050.00217.02
8.0.30.0080.01617.01
8.0.20.0120.00617.40
8.0.10.0000.00717.14
8.0.00.0090.01016.85
7.4.330.0030.00315.07
7.4.320.0030.00316.60
7.4.300.0000.00716.61
7.4.290.0080.00016.74
7.4.280.0020.00516.72
7.4.270.0030.00316.72
7.4.260.0030.00516.47
7.4.250.0030.00516.60
7.4.240.0040.00416.61
7.4.230.0030.00316.77
7.4.220.0140.01416.54
7.4.210.0050.01216.73
7.4.200.0000.00816.44
7.4.160.0080.00816.48
7.4.150.0100.01017.40
7.4.140.0130.00517.86
7.4.130.0090.00916.64
7.4.120.0110.00716.48
7.4.110.0100.00716.60
7.4.100.0140.01116.72
7.4.90.0070.01116.63
7.4.80.0120.01219.39
7.4.70.0070.01016.44
7.4.60.0110.00616.56
7.4.50.0030.00316.62
7.4.40.0080.00816.61
7.4.30.0100.00716.60
7.4.00.0050.01415.24
7.3.330.0020.00213.43
7.3.320.0070.00713.47
7.3.310.0000.00816.46
7.3.300.0030.00316.52
7.3.290.0030.00316.49
7.3.280.0070.00916.51
7.3.270.0150.00417.40
7.3.260.0130.01016.68
7.3.250.0110.00716.79
7.3.240.0090.01216.73
7.3.230.0170.00316.43
7.3.210.0170.00416.52
7.3.200.0070.01019.39
7.3.190.0040.01316.44
7.3.180.0060.00916.54
7.3.170.0090.00916.61
7.3.160.0110.00816.45
7.3.120.0060.01215.28
7.3.110.0040.00715.28
7.3.100.0110.00715.28
7.3.90.0080.00615.28
7.3.80.0070.00715.28
7.3.70.0040.01115.28
7.3.60.0110.00415.28
7.3.50.0130.00315.28
7.3.40.0090.00315.28
7.3.30.0100.00315.28
7.3.20.0070.01016.70
7.3.10.0030.01316.53
7.3.00.0030.01016.53
7.2.330.0080.01616.88
7.2.320.0040.01416.46
7.2.310.0130.00316.58
7.2.300.0120.01216.59
7.2.290.0160.00616.66
7.2.250.0070.01315.28
7.2.240.0070.01315.39
7.2.230.0060.00915.28
7.2.220.0030.01315.33
7.2.210.0090.00015.28
7.2.200.0070.00315.28
7.2.190.0030.01215.28
7.2.180.0030.01215.28
7.2.170.0070.00715.28
7.2.60.0100.00616.73
7.2.00.0070.00719.54
7.1.330.0040.00915.84
7.1.320.0060.00815.63
7.1.310.0090.00615.81
7.1.300.0100.00315.87
7.1.290.0060.00315.86
7.1.280.0030.01015.84
7.1.270.0090.00615.90
7.1.260.0070.00715.71
7.1.200.0100.00715.77
7.1.100.0060.00618.27
7.1.70.0030.01317.22
7.1.60.0110.01419.50
7.1.50.0140.01016.93
7.1.00.0030.07722.40
7.0.200.0160.00015.08
7.0.140.0100.06722.00
7.0.100.0070.05320.07
7.0.90.0030.05720.04
7.0.80.0170.04720.10
7.0.70.0400.07319.94
7.0.60.0130.07720.12
7.0.50.0170.05720.38
7.0.40.0130.07720.01
7.0.30.0070.10020.12
7.0.20.0200.06020.10
7.0.10.0130.06319.95
7.0.00.0000.04720.07
5.6.280.0030.07021.17
5.6.250.0070.04320.63
5.6.240.0070.08720.57
5.6.230.0100.07720.77
5.6.220.0130.06020.56
5.6.210.0130.06320.63
5.6.200.0130.05321.09
5.6.190.0100.08021.07
5.6.180.0200.07021.09
5.6.170.0070.07021.16
5.6.160.0000.06721.01
5.6.150.0030.06021.19
5.6.140.0070.08721.16
5.6.120.0100.04721.06
5.6.110.0130.07721.07
5.6.100.0070.07020.93
5.6.90.0200.06320.98
5.6.80.0070.07720.52
5.6.70.0100.07020.39
5.6.60.0070.05020.54
5.6.50.0100.07320.45
5.6.40.0070.04020.55
5.6.30.0200.03720.45
5.6.20.0030.04320.54
5.6.10.0000.04320.48
5.6.00.0030.08020.43
5.5.380.0130.03320.41
5.5.370.0100.07720.56
5.5.360.0000.05720.40
5.5.350.0030.06020.43
5.5.340.0130.07720.88
5.5.330.0070.08020.79
5.5.320.0000.06720.97
5.5.310.0070.08320.94
5.5.300.0070.07320.91
5.5.290.0030.05320.80
5.5.280.0070.08020.81
5.5.270.0000.05320.78
5.5.260.0030.09020.84
5.5.250.0000.04720.79
5.5.240.0100.06720.36
5.5.230.0070.08720.31
5.5.220.0070.07320.16
5.5.210.0070.04320.30
5.5.200.0100.07020.31
5.5.190.0170.05720.02
5.5.180.0070.05720.29
5.5.160.0130.07020.23
5.5.150.0130.07320.31
5.5.140.0100.07020.19
5.5.130.0030.07720.27
5.5.120.0130.07320.13
5.5.110.0070.07020.04
5.5.100.0130.07320.02
5.5.90.0130.04320.05
5.5.80.0170.06020.12
5.5.70.0030.08320.11
5.5.60.0070.08020.16
5.5.50.0070.08020.13
5.5.40.0100.07720.20
5.5.30.0030.08320.13
5.5.20.0070.07320.15
5.5.10.0070.07720.09
5.5.00.0100.07320.07
5.4.450.0030.08019.46
5.4.440.0030.08019.36
5.4.430.0170.05719.44
5.4.420.0230.03319.49
5.4.410.0130.07319.24
5.4.400.0070.04719.21
5.4.390.0070.07718.88
5.4.380.0100.08019.18
5.4.370.0130.06319.04
5.4.360.0130.06719.03
5.4.350.0070.07019.05
5.4.340.0000.05719.21
5.4.320.0100.07318.90
5.4.310.0100.04719.05
5.4.300.0000.08319.25
5.4.290.0030.07019.16
5.4.280.0100.07319.21
5.4.270.0070.06319.04
5.4.260.0070.06019.20
5.4.250.0070.07718.90
5.4.240.0070.07719.09
5.4.230.0130.04719.04
5.4.220.0130.06019.20
5.4.210.0000.04319.18
5.4.200.0030.04018.84
5.4.190.0000.04319.02
5.4.180.0030.07019.17
5.4.170.0130.04718.84
5.4.160.0130.07019.10
5.4.150.0030.04719.21
5.4.140.0130.06316.49
5.4.130.0070.07016.50
5.4.120.0070.07316.46
5.4.110.0100.06716.47
5.4.100.0030.04316.51
5.4.90.0100.07016.58
5.4.80.0130.06716.38
5.4.70.0100.04316.54
5.4.60.0070.03316.47
5.4.50.0070.04016.37
5.4.40.0070.07016.37
5.4.30.0070.07316.37
5.4.20.0070.05016.52
5.4.10.0070.03716.41
5.4.00.0030.03715.92

preferences:
49.36 ms | 401 KiB | 5 Q