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]!='_')&&(strtolower($parm)!='class')&&(!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} if ($text) { $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 .= (($o['_disabled']==true)?' disabled':''); $class .= ((isset($o['class']))?' '.$o['class']:''); $class = trim($class); if($o['_disabled']==true)$o['disabled']='disabled'; $attr = dgs_attributes($o); $out = vsprintf('<%1$s class="%2$s"%3$s>%4$s'.((!dgs_isVoidTag($element))?'</%1$s>':''), array( $element, $class, $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; } } else { return false; } } 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 ); } ?>

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.0060.00918.31
8.3.50.0110.01121.88
8.3.40.0070.01118.63
8.3.30.0170.00318.96
8.3.20.0040.00420.29
8.3.10.0040.00421.85
8.3.00.0080.00019.13
8.2.180.0070.01118.27
8.2.170.0110.01122.96
8.2.160.0060.01220.39
8.2.150.0060.00324.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0030.00519.23
8.2.110.0060.01622.08
8.2.100.0120.00017.78
8.2.90.0030.00618.03
8.2.80.0080.00019.27
8.2.70.0080.00017.91
8.2.60.0050.00517.80
8.2.50.0060.00318.10
8.2.40.0000.00920.42
8.2.30.0050.00518.09
8.2.20.0080.00017.74
8.2.10.0040.00418.08
8.2.00.0040.00417.75
8.1.280.0070.01425.92
8.1.270.0040.00418.72
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0030.00623.83
8.1.230.0040.00822.66
8.1.220.0000.00817.76
8.1.210.0060.00318.77
8.1.200.0030.00617.35
8.1.190.0030.00517.35
8.1.180.0040.00418.10
8.1.170.0040.00418.60
8.1.160.0000.00722.21
8.1.150.0050.00318.75
8.1.140.0040.00417.50
8.1.130.0030.00317.78
8.1.120.0040.00417.49
8.1.110.0000.00817.49
8.1.100.0070.00017.50
8.1.90.0000.00717.51
8.1.80.0060.00317.44
8.1.70.0000.00717.52
8.1.60.0040.00417.47
8.1.50.0090.00017.53
8.1.40.0070.00317.51
8.1.30.0000.00917.64
8.1.20.0000.00717.61
8.1.10.0000.00817.47
8.1.00.0000.00917.42
8.0.300.0040.00420.16
8.0.290.0040.00416.88
8.0.280.0100.00018.38
8.0.270.0000.00717.28
8.0.260.0000.00717.21
8.0.250.0030.00317.03
8.0.240.0050.00216.91
8.0.230.0030.00316.95
8.0.220.0030.00316.88
8.0.210.0000.00816.86
8.0.200.0030.00316.96
8.0.190.0000.00916.90
8.0.180.0040.00416.91
8.0.170.0000.00816.91
8.0.160.0030.00517.00
8.0.150.0040.00416.80
8.0.140.0040.00416.78
8.0.130.0040.00413.37
8.0.120.0080.00016.78
8.0.110.0070.00016.97
8.0.100.0040.00416.80
8.0.90.0050.00217.03
8.0.80.0070.01016.94
8.0.70.0040.00416.95
8.0.60.0030.00516.74
8.0.50.0070.00016.80
8.0.30.0130.01016.84
8.0.20.0160.00517.40
8.0.10.0000.00816.90
8.0.00.0110.00916.63
7.4.330.0050.00315.03
7.4.320.0000.00616.68
7.4.300.0000.00716.66
7.4.290.0070.00016.55
7.4.280.0000.00816.36
7.4.270.0070.00016.63
7.4.260.0000.00716.64
7.4.250.0040.00416.49
7.4.240.0030.00516.53
7.4.230.0000.00716.68
7.4.220.0070.01016.48
7.4.210.0100.01016.48
7.4.200.0000.00716.65
7.4.160.0110.00716.47
7.4.150.0150.01017.40
7.4.140.0130.00817.86
7.4.130.0060.01516.53
7.4.120.0110.01016.57
7.4.110.0120.00616.41
7.4.100.0090.00916.39
7.4.90.0110.01516.54
7.4.80.0040.01419.39
7.4.70.0090.00916.43
7.4.60.0070.01116.48
7.4.50.0000.00416.30
7.4.40.0000.02016.59
7.4.30.0130.01016.52
7.4.10.0030.01314.85
7.4.00.0080.00914.93
7.3.330.0000.00513.12
7.3.320.0100.00312.99
7.3.310.0040.00416.16
7.3.300.0070.00016.22
7.3.290.0090.00716.22
7.3.280.0080.01016.28
7.3.270.0080.01417.40
7.3.260.0180.00316.46
7.3.250.0090.01416.27
7.3.240.0080.00816.21
7.3.230.0090.01116.39
7.3.210.0080.00816.34
7.3.200.0070.01019.39
7.3.190.0120.00816.23
7.3.180.0100.00616.25
7.3.170.0000.01716.38
7.3.160.0150.00316.33
7.3.130.0090.00914.41
7.3.120.0050.01214.81
7.3.110.0040.01114.68
7.3.100.0070.00514.79
7.3.90.0060.00914.77
7.3.80.0050.00514.74
7.3.70.0100.00514.72
7.3.60.0060.00914.73
7.3.50.0070.00714.65
7.3.40.0060.00614.73
7.3.30.0050.00914.70
7.3.20.0090.00616.52
7.3.10.0030.01116.47
7.3.00.0080.00616.31
7.2.330.0090.01316.64
7.2.320.0060.01216.70
7.2.310.0140.00316.43
7.2.300.0090.01216.47
7.2.290.0120.01216.57
7.2.260.0130.00714.72
7.2.250.0080.01114.93
7.2.240.0080.00914.88
7.2.230.0050.01214.82
7.2.220.0100.00414.86
7.2.210.0060.00714.89
7.2.200.0060.00914.94
7.2.190.0070.00715.03
7.2.180.0060.00914.76
7.2.170.0040.00814.84
7.2.160.0030.01014.91
7.2.150.0070.00816.84
7.2.140.0070.00616.53
7.2.130.0040.01116.71
7.2.120.0000.01416.67
7.2.110.0020.01316.55
7.2.100.0080.00816.79
7.2.90.0050.00716.60
7.2.80.0050.01116.60
7.2.70.0020.01116.61
7.2.60.0060.00616.66
7.2.50.0070.00716.65
7.2.40.0050.01216.66
7.2.30.0060.00616.70
7.2.20.0030.01316.58
7.2.10.0080.00616.71
7.2.00.0060.00717.43
7.1.330.0060.00915.60
7.1.320.0020.00815.56
7.1.310.0030.01015.76
7.1.300.0040.00715.63
7.1.290.0080.00415.58
7.1.280.0040.01015.60
7.1.270.0080.00315.41
7.1.260.0050.00715.66
7.1.250.0050.00415.64
7.1.240.0040.01215.81
7.1.230.0070.01015.43
7.1.220.0000.01415.63
7.1.210.0000.01115.68
7.1.200.0020.01215.65
7.1.190.0000.01515.67
7.1.180.0060.00315.80
7.1.170.0060.00615.68
7.1.160.0040.00815.73
7.1.150.0040.00715.54
7.1.140.0030.00615.77
7.1.130.0040.00715.74
7.1.120.0030.01015.72
7.1.110.0070.00715.62
7.1.100.0030.00716.72
7.1.90.0000.01515.67
7.1.80.0140.00315.74
7.1.70.0020.01016.30
7.1.60.0080.01017.51
7.1.50.0080.01025.30
7.1.40.0030.01015.85
7.1.30.0110.00315.48
7.1.20.0080.00515.69
7.1.10.0040.00415.64
7.1.00.0060.04219.01
7.0.330.0040.00415.40
7.0.320.0000.01315.43
7.0.310.0100.00315.01
7.0.300.0030.01015.28
7.0.290.0070.00315.51
7.0.280.0040.00815.16
7.0.270.0110.00415.00
7.0.260.0110.00315.38
7.0.250.0070.00315.05
7.0.240.0110.00315.49
7.0.230.0060.01015.37
7.0.220.0050.00515.32
7.0.210.0030.00715.00
7.0.200.0050.00714.96
7.0.190.0030.00815.24
7.0.180.0000.01215.16
7.0.170.0100.00315.48
7.0.160.0040.01515.37
7.0.150.0040.00415.25
7.0.140.0080.03518.63
7.0.130.0060.00615.21
7.0.120.0000.01515.13
7.0.110.0080.00015.22
7.0.100.0140.01717.64
7.0.90.0080.02517.75
7.0.80.0000.02817.68
7.0.70.0000.02817.79
7.0.60.0030.02917.65
7.0.50.0050.02617.88
7.0.40.0060.02516.62
7.0.30.0050.04716.66
7.0.20.0050.04416.79
7.0.10.0080.04316.68
7.0.00.0070.03816.69
5.6.400.0030.00614.43
5.6.390.0070.00714.37
5.6.380.0040.01114.25
5.6.370.0060.00914.02
5.6.360.0030.01014.06
5.6.350.0040.00814.03
5.6.340.0000.01514.07
5.6.330.0090.00914.50
5.6.320.0070.00414.06
5.6.310.0090.00314.06
5.6.300.0160.00014.43
5.6.290.0070.00714.03
5.6.280.0090.03517.72
5.6.270.0070.00714.35
5.6.260.0100.00714.35
5.6.250.0090.02217.47
5.6.240.0050.02517.40
5.6.230.0050.02517.50
5.6.220.0040.02517.38
5.6.210.0100.01717.58
5.6.200.0070.02217.62
5.6.190.0000.05317.68
5.6.180.0060.04317.70
5.6.170.0070.02117.79
5.6.160.0070.04417.63
5.6.150.0070.02417.72
5.6.140.0050.03917.55
5.6.130.0090.04517.89
5.6.120.0090.02217.59
5.6.110.0130.04017.79
5.6.100.0070.04117.68
5.6.90.0070.03617.69
5.6.80.0070.02217.15
5.6.70.0070.03717.32
5.6.60.0100.03717.37
5.6.50.0060.04517.36
5.6.40.0050.03717.48
5.6.30.0120.03317.39
5.6.20.0030.04617.42
5.6.10.0080.03017.35
5.6.00.0090.03117.37
5.5.380.0050.02517.40
5.5.370.0050.02317.34
5.5.360.0080.02417.32
5.5.350.0050.02317.41
5.5.340.0050.03317.63
5.5.330.0070.04517.68
5.5.320.0050.04317.62
5.5.310.0070.05717.49
5.5.300.0020.04317.57
5.5.290.0070.04417.45
5.5.280.0060.03317.57
5.5.270.0030.03117.36
5.5.260.0020.03517.56
5.5.250.0050.05017.37
5.5.240.0070.04117.18
5.5.230.0080.04517.26
5.5.220.0070.04417.17
5.5.210.0060.04117.19
5.5.200.0080.03617.26
5.5.190.0130.03317.21
5.5.180.0030.03517.13
5.5.170.0030.01013.91
5.5.160.0050.02317.28
5.5.150.0090.02917.14
5.5.140.0090.03817.32
5.5.130.0060.04017.20
5.5.120.0100.04017.24
5.5.110.0070.03817.18
5.5.100.0030.04517.13
5.5.90.0050.04517.10
5.5.80.0010.03417.25
5.5.70.0080.04316.94
5.5.60.0050.03516.95
5.5.50.0050.03117.19
5.5.40.0060.04217.06
5.5.30.0020.02817.12
5.5.20.0050.02817.25
5.5.10.0060.03017.23
5.5.00.0030.04817.03
5.4.450.0120.03715.29
5.4.440.0000.02615.21
5.4.430.0070.03215.15
5.4.420.0050.02215.13
5.4.410.0050.03715.10
5.4.400.0080.02715.04
5.4.390.0090.03215.08
5.4.380.0000.04415.07
5.4.370.0040.02215.05
5.4.360.0090.03714.98
5.4.350.0110.02515.13
5.4.340.0040.02215.04
5.4.330.0030.01011.07
5.4.320.0050.03915.14
5.4.310.0020.02415.04
5.4.300.0020.03815.03
5.4.290.0070.03515.03
5.4.280.0040.03015.08
5.4.270.0030.02414.98
5.4.260.0030.04315.05
5.4.250.0030.04015.02
5.4.240.0000.02515.02
5.4.230.0090.03515.07
5.4.220.0030.04014.98
5.4.210.0030.02415.14
5.4.200.0090.03515.03
5.4.190.0070.03714.96
5.4.180.0030.04215.07
5.4.170.0040.02414.93
5.4.160.0060.02815.18
5.4.150.0080.03615.17
5.4.140.0060.03713.69
5.4.130.0030.03913.58
5.4.120.0050.03713.64
5.4.110.0080.01713.70
5.4.100.0050.03713.68
5.4.90.0020.03513.78
5.4.80.0050.03513.71
5.4.70.0090.03713.63
5.4.60.0060.03813.72
5.4.50.0000.04313.75
5.4.40.0000.02813.71
5.4.30.0070.01713.68
5.4.20.0030.02013.78
5.4.10.0050.03613.66
5.4.00.0020.04413.38

preferences:
52.67 ms | 401 KiB | 5 Q