3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Stub class HTMLCheckField {} /* * This file is part of the MediaWiki extension BetaFeatures. * * BetaFeatures is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * BetaFeatures is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with BetaFeatures. If not, see <http://www.gnu.org/licenses/>. * * New HTML check field * * @file * @ingroup Extensions * @copyright 2013 Mark Holmquist and others; see AUTHORS * @license GNU General Public License version 2 or later */ class NewHTMLCheckField extends HTMLCheckField { /** * @var boolean directive whether to include a label with the checkbox */ protected $includeLabel = true; // Protected internal methods for getting the bits of the field // Override these in subclasses (see HTMLFeatureField, e.g.) /** * @param string $value * @param string $attr * @return string */ protected function getCheckboxHTML( $value, $attr ) { if ( !empty( $this->mParams['invert'] ) ) { $value = !$value; } $out = $this->mParent->getOutput(); $out->addModules( 'ext.betaFeatures' ); $out->addModuleStyles( 'ext.betaFeatures.styles' ); $out->enableOOUI(); // TODO: Support $this->getTooltipAndAccessKey? return Html::openElement( 'div', [ 'class' => 'mw-ui-feature-checkbox' ] ) . new OOUI\FieldLayout( new OOUI\CheckboxInputWidget( [ 'name' => $this->mName, 'selected' => $value, 'value' => 1, 'classes' => $this->mClass ? [ $this->mClass ] : [], 'disabled' => isset( $this->mParams['disabled'] ) && $this->mParams['disabled'] === true, ] ), [ 'align' => 'inline', 'label' => $this->includeLabel ? $this->mLabel : '', ] ) . Html::closeElement( 'div' ); } /** * @return string */ protected function getPostCheckboxLabelHTML() { return Html::rawElement( 'label', [ 'for' => $this->mID, 'class' => 'mw-ui-text-check-label' ], $this->mLabel ); } /** * @param string $value * @param null $attr * @return String */ public function getInputHTML( $value, $attr = null ) { return $this->getCheckboxHTML( $value, $attr ); } public function getInputOOUI( $value ) { // Use the same output as for the HTML version, otherwise OOUIHTMLForm would use // a plain checkbox, inherited from HTMLCheckField. This isn't actually a widget // (just a HTML string) but that's okay, HTMLFormField::getOOUI() will handle it. return $this->getInputHTML( $value ); } protected function getFieldLayoutOOUI( $inputField, $config ) { // Label is already included in the field's HTML, do not duplicate it unset( $config['label'] ); return parent::getFieldLayoutOOUI( $inputField, $config ); } } /* * This file is part of the MediaWiki extension BetaFeatures. * * BetaFeatures is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * BetaFeatures is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with BetaFeatures. If not, see <http://www.gnu.org/licenses/>. * * HTML feature field * * @file * @ingroup Extensions * @copyright 2013 Mark Holmquist and others; see AUTHORS * @license GNU General Public License version 2 or later */ class HTMLFeatureField extends NewHTMLCheckField { const OPTION_ENABLED = '1'; const OPTION_DISABLED = '0'; function __construct( $options ) { // We need the new checkbox style to have a sane-looking field $options['mw-ui'] = true; parent::__construct( $options ); } function getHeaderHTML( $value ) { $html = Html::openElement( 'div', [ 'class' => 'mw-ui-feature-header', ] ); $attrs = $this->getTooltipAndAccessKey(); $attrs['id'] = $this->mID; $attrs['class'] = 'mw-ui-feature-toggle'; if ( isset( $this->mParams['disabled'] ) && $this->mParams['disabled'] === true ) { $attrs['disabled'] = true; } $html .= Html::openElement( 'div', [ 'class' => 'mw-ui-feature-title-contain', ] ); $html .= $this->getCheckboxHTML( $value, $attrs ); // Close -title-contain $html .= Html::closeElement( 'div' ); if ( isset( $this->mParams['info-message'] ) ) { $infoLink = $this->mParent->msg( $this->mParams['info-message'] )->escaped(); } else { $infoLink = $this->mParams['info-link']; } if ( isset( $this->mParams['discussion-message'] ) ) { $discussionLink = $this->mParent->msg( $this->mParams['discussion-message'] )->escaped(); } else { $discussionLink = $this->mParams['discussion-link']; } $infoLinkClasses = [ 'mw-ui-feature-info-links', ]; if ( isset( $infoLink ) || isset( $discussionLink ) ) { $infoLinkClasses[] = 'filled'; } $html .= Html::openElement( 'div', [ 'class' => $infoLinkClasses, ] ); $out = $this->mParent->getOutput(); if ( isset( $infoLink ) ) { $out->addModuleStyles( 'oojs-ui.styles.icons-content' ); $html .= Html::rawElement( 'a', [ 'href' => $infoLink, 'class' => 'mw-ui-feature-info-link', ], new OOUI\IconWidget( [ 'icon' => 'article' ] ). $this->mParent->msg( 'mw-ui-feature-info' )->escaped() ); $html .= ' '; } if ( isset( $discussionLink ) ) { $out->addModuleStyles( 'oojs-ui.styles.icons-alerts' ); $html .= Html::rawElement( 'a', [ 'href' => $discussionLink, 'class' => 'mw-ui-feature-discussion-link', ], new OOUI\IconWidget( [ 'icon' => 'speechBubbles' ] ). $this->mParent->msg( 'mw-ui-feature-discuss' )->escaped() ); } // mw-ui-feature-info-links $html .= Html::closeElement( 'div' ); // Close -header $html .= Html::closeElement( 'div' ); return $html; } function getMainHTML( $value ) { $parent = $this->mParent; $html = Html::openElement( 'div', [ 'class' => 'mw-ui-feature-main', ] ); $html .= Html::openElement( 'div', [ 'class' => 'mw-ui-feature-meta', ] ); if ( isset( $this->mParams['user-count'] ) ) { $userCountMsg = 'mw-ui-feature-user-count'; if ( isset( $this->mParams['user-count-msg'] ) ) { $userCountMsg = $this->mParams['user-count-msg']; } $html .= Html::rawElement( 'p', [ 'class' => 'mw-ui-feature-user-count' ], $parent->msg( $userCountMsg )->numParams( $this->mParams['user-count'] )->escaped() ); $attrs['data-count'] = $this->mParams['user-count']; } if ( isset( $this->mParams['desc-message'] ) ) { $html .= Html::rawElement( 'p', [ 'class' => 'mw-ui-feature-description', ], $parent->msg( $this->mParams['desc-message'] )->parse() ); } $html .= Html::openElement( 'ul', [ 'class' => 'mw-ui-feature-requirements-list', ] ); if ( isset( $this->mParams['requirements'] ) ) { if ( isset( $this->mParams['requirements']['javascript'] ) && $this->mParams['requirements']['javascript'] ) { $html .= Html::rawElement( 'li', [ 'class' => 'mw-ui-feature-requirements-javascript' ], $parent->msg( 'mw-ui-feature-requirements-javascript' )->escaped() ); } if ( isset( $this->mParams['requirements']['blacklist'] ) ) { $html .= Html::openElement( 'li', [ 'class' => 'mw-ui-feature-requirements-browser' ] ); $browserCount = count( $this->mParams['requirements']['blacklist'] ); $html .= $parent->msg( 'mw-ui-feature-requirements-browser', $browserCount )->escaped(); $html .= Html::openElement( 'ul' ); foreach ( $this->mParams['requirements']['blacklist'] as $browser => $versions ) { $browserString = $browser; if ( $versions ) { foreach ( $versions as $version ) { $browserString .= ' ' . implode( ' ', $version ); } } $html .= Html::element( 'li', [], $browserString ); } $html .= Html::closeElement( 'ul' ); $html .= Html::closeElement( 'li' ); } if ( isset( $this->mParams['requirements']['skin-not-supported'] ) && $this->mParams['requirements']['skin-not-supported'] === true ) { $html .= Html::openElement( 'li', [ 'class' => 'mw-ui-feature-requirements-skins' ] ); $skinCount = count( $this->mParams['requirements']['skins'] ); $html .= $parent->msg( 'mw-ui-feature-requirements-skins', $skinCount )->escaped(); $html .= Html::openElement( 'ul' ); foreach ( $this->mParams['requirements']['skins'] as $skin ) { $html .= Html::element( 'li', [], $parent->msg( "skinname-$skin" )->text() ); } $html .= Html::closeElement( 'ul' ); $html .= Html::closeElement( 'li' ); } if ( isset( $this->mParams['requirements']['betafeatures-messages'] ) ) { $html .= Html::openElement( 'li', [ 'class' => 'mw-ui-feature-requirements-betafeatures' ] ); $featureCount = count( $this->mParams['requirements']['betafeatures-messages'] ); $html .= $parent->msg( 'mw-ui-feature-requirements-betafeatures', $featureCount )->escaped(); $html .= Html::openElement( 'ul' ); foreach ( $this->mParams['requirements']['betafeatures-messages'] as $message ) { $html .= Html::rawElement( 'li', [], $parent->msg( $message )->escaped() ); } $html .= Html::closeElement( 'ul' ); $html .= Html::closeElement( 'li' ); } } // mw-ui-feature-requirements-list $html .= Html::closeElement( 'ul' ); // Close -meta $html .= Html::closeElement( 'div' ); $html .= Html::openElement( 'div', [ 'class' => 'mw-ui-feature-screenshot-contain', ] ); if ( isset( $this->mParams['screenshot'] ) ) { $screenshot = $this->mParams['screenshot']; // The screenshot parameter is either a string with a filename // or an array that specifies a screenshot for each language, // and default screenshots for rtl and ltr languages if ( is_array( $screenshot ) ) { $language = $this->mParent->getLanguage(); $langCode = $language->getCode(); if ( array_key_exists( $langCode, $screenshot ) ) { $screenshot = $screenshot[$langCode]; } else { $screenshot = $screenshot[$language->getDir()]; } } $html .= Html::element( 'img', [ 'src' => $screenshot, 'class' => 'mw-ui-feature-screenshot', ] ); } // Close -screenshot-contain $html .= Html::closeElement( 'div' ); // Close -main $html .= Html::closeElement( 'div' ); return $html; } function getInputHTML( $value ) { $html = ''; $divClasses = [ 'mw-ui-feature-field', ]; // Use 'cssclass' to populate this. Separate from 'class', of course. if ( $this->mClass !== '' ) { $divClasses[] = $this->mClass; } $html .= Html::openElement( 'div', [ 'class' => implode( ' ', $divClasses ), ] ); $html .= Html::openElement( 'div', [ 'class' => 'mw-ui-feature-contain', ] ); $html .= $this->getHeaderHTML( $value ); $html .= $this->getMainHTML( $value ); // mw-ui-feature-contain $html .= Html::closeElement( 'div' ); // mw-ui-feature-field $html .= Html::closeElement( 'div' ); return $html; } /** * Override to use integers, so we don't lose the database rows on * unset... * @param WebRequest $request * @return string */ function loadDataFromRequest( $request ) { $res = parent::loadDataFromRequest( $request ); if ( $res === true ) { return self::OPTION_ENABLED; } elseif ( $res === false ) { return self::OPTION_DISABLED; } else { // Dunno what happened, but I'm not gonna fight it. return $res; } } } echo "No fatal error";

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.01516.88
8.3.50.0070.01417.91
8.3.40.0080.00818.85
8.3.30.0150.00018.78
8.3.20.0030.00520.50
8.3.10.0000.01121.95
8.3.00.0040.01123.63
8.2.180.0090.00618.43
8.2.170.0040.01222.96
8.2.160.0090.00620.64
8.2.150.0080.00024.18
8.2.140.0100.00324.66
8.2.130.0040.00422.23
8.2.120.0070.00726.35
8.2.110.0060.00322.31
8.2.100.0040.00817.91
8.2.90.0050.00519.29
8.2.80.0000.00817.97
8.2.70.0050.00317.63
8.2.60.0080.00017.93
8.2.50.0040.00418.22
8.2.40.0000.00820.72
8.2.30.0000.00819.30
8.2.20.0030.00518.11
8.2.10.0040.00418.19
8.2.00.0040.00417.99
8.1.280.0110.00725.92
8.1.270.0030.00620.11
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0060.00320.87
8.1.230.0110.00020.55
8.1.220.0100.00017.74
8.1.210.0030.00618.77
8.1.200.0030.00617.48
8.1.190.0030.00517.48
8.1.180.0060.00320.44
8.1.170.0000.00818.75
8.1.160.0000.00819.00
8.1.150.0040.00420.21
8.1.140.0000.00719.28
8.1.130.0000.00717.60
8.1.120.0000.00717.52
8.1.110.0000.00717.45
8.1.100.0040.00417.55
8.1.90.0040.00817.61
8.1.80.0050.00217.54
8.1.70.0070.00017.63
8.1.60.0040.00417.59
8.1.50.0030.00517.51
8.1.40.0040.00417.57
8.1.30.0050.00517.61
8.1.20.0000.00817.59
8.1.10.0040.00417.63
8.1.00.0060.00317.53
8.0.300.0040.00418.77
8.0.290.0000.00816.88
8.0.280.0000.00718.50
8.0.270.0070.00017.32
8.0.260.0000.00716.99
8.0.250.0000.00816.98
8.0.240.0080.00316.95
8.0.230.0000.00817.14
8.0.220.0050.00217.06
8.0.210.0030.00316.96
8.0.200.0030.00316.96
8.0.190.0060.00317.05
8.0.180.0040.00416.92
8.0.170.0060.00317.05
8.0.160.0000.00816.98
8.0.150.0050.00216.98
8.0.140.0070.00016.96
8.0.130.0000.00613.42
8.0.120.0000.00816.81
8.0.110.0000.00816.97
8.0.100.0040.00417.00
8.0.90.0040.00417.02
8.0.80.0070.01016.99
8.0.70.0040.00416.88
8.0.60.0080.00016.92
8.0.50.0030.00617.02
8.0.30.0070.01017.27
8.0.20.0100.01217.40
8.0.10.0040.00417.06
8.0.00.0090.00917.03
7.4.330.0030.00315.55
7.4.320.0030.00316.57
7.4.300.0070.00016.58
7.4.290.0000.00716.55
7.4.280.0000.00816.67
7.4.270.0030.00516.67
7.4.260.0040.00416.61
7.4.250.0050.00316.67
7.4.240.0040.00416.59
7.4.230.0040.00416.36
7.4.220.0070.01116.72
7.4.210.0130.00316.48
7.4.200.0040.00416.56
7.4.160.0140.00316.68
7.4.150.0180.00417.40
7.4.140.0080.01117.86
7.4.130.0120.00916.63
7.4.120.0140.00716.61
7.4.110.0150.00916.48
7.4.100.0110.00616.48
7.4.90.0070.01616.67
7.4.80.0110.00819.39
7.4.70.0080.01216.43
7.4.60.0160.00616.44
7.4.50.0110.00416.48
7.4.40.0030.01316.55
7.4.30.0100.00616.55
7.4.00.0070.01014.98
7.3.330.0050.00013.25
7.3.320.0030.00313.28
7.3.310.0030.00316.46
7.3.300.0000.00716.46
7.3.290.0070.00816.44
7.3.280.0060.00916.41
7.3.270.0030.02217.40
7.3.260.0080.01316.48
7.3.250.0120.00816.56
7.3.240.0120.01016.69
7.3.230.0070.01016.48
7.3.210.0120.00916.31
7.3.200.0050.01716.52
7.3.190.0030.01416.55
7.3.180.0120.00416.60
7.3.170.0070.01316.61
7.3.160.0040.01216.46
7.2.330.0150.00916.51
7.2.320.0120.00916.85
7.2.310.0060.01616.59
7.2.300.0180.00616.56
7.2.290.0110.00616.42
7.2.60.0090.00616.87
7.2.00.0080.00819.36
7.1.200.0060.00915.54
7.1.120.0070.00718.55
7.1.110.0040.01117.63
7.1.100.0070.01418.18
7.1.90.0060.00917.82
7.1.80.0030.01017.90
7.1.70.0000.01416.68
7.1.60.0130.01634.87
7.1.50.0170.01134.85
7.1.40.0200.01334.29
7.1.30.0140.01434.30
7.1.20.0190.01034.38
7.1.10.0070.00716.49
7.1.00.0000.01416.39

preferences:
56.88 ms | 401 KiB | 5 Q