3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CheckPlateform { //All values if not explicit //PHP version const MIN_ALLOWED_PHP_VERSION = "5.0.0"; const MAX_ALLOWED_PHP_VERSION = null;//excluded //Memory const MIN_ALLOWED_MEMORY_CLI = 512;//In M const MAX_ALLOWED_MEMORY_CLI = null;//In M const MIN_ALLOWED_MEMORY_WEB = 128;//In M const MAX_ALLOWED_MEMORY_WEB = null;//In M //Execution time const MIN_ALLOWED_EXECUTION_TIME_CLI = 30;//in s const MAX_ALLOWED_EXECUTION_TIME_CLI = null;//in s const MIN_ALLOWED_EXECUTION_TIME_WEB = 30;//in s const MAX_ALLOWED_EXECUTION_TIME_WEB = null;//in s //Internet access const CHECK_INTERNET_ACCESS = true;//or false //MySql const MYSQL_HOST = 'localhost';//or null const MIN_ALLOWED_MYSQL_VERSION = "5.5.0"; const MAX_ALLOWED_MYSQL_VERSION = null;//excluded //List of allowed handlers protected $expectedApi = array( 'cli', 'apache2handler' ); //List of necessary Apache modules protected $expectedApacheModules = array( 'mod_rewrite' ); //List of allowed operating systems protected $expectedOS = array( 'windows', 'linux' ); //List of allowed architectures protected $expectedArchitecture = array( 'amd64', 'x86_64' ); //List of necessary PHP extensions protected $expectedExtensions = array(//Extension name 'json', 'SPL', 'PDO', 'SimpleXML', 'curl', 'xsl' ); //List of necessary PHP classes protected $expectedClasses = array(//Class name 'Silex\Application', 'Monolog\Logger', 'Symfony\Component\Console\Application', 'Symfony\Component\Form\Form', 'Symfony\Component\Security\Core\SecurityContext', 'Symfony\Component\Translation\Translator', 'Symfony\Component\Validator\Validator', 'Swift_Mailer', 'Knp\Snappy\Pdf', 'Doctrine\ORM\EntityManager', 'Carbon\Carbon' ); //List of necessary files with access rights protected $expectedFileFolders = array(//Folder relative path form project root 'vendor/h4cc/wkhtmltopdf-amd64/bin/' => 'R', 'var/log' => 'RW', 'var' => 'RW' ); /* * DO NOT EDIT BELOW */ const METHOD_PREFIX = 'assert'; private $lineBreak; private $apiSuffix; public function __construct() { $this->lineBreak = ('cli' == php_sapi_name() ? "\n" : "<br/>"); $this->apiSuffix = ('cli' == php_sapi_name() ? "_CLI" : "_WEB"); } public function execute() { //Loop through all check methods by introspection $methods = get_class_methods(__CLASS__); $finalReturn = true; foreach ($methods as $method) { if (self::METHOD_PREFIX == substr($method, 0, strlen(self::METHOD_PREFIX))) { $return = $this->$method(); $finalReturn = $finalReturn && $return; echo str_pad($method, 50, '.') . ($return ? 'OK' : 'KO <<<') . $this->lineBreak; } } return $finalReturn; } protected function assertApi() { $api = php_sapi_name(); foreach ($this->expectedApi as $expectedApi) { if (0 == strcasecmp($api, $expectedApi)) { return true; } } echo 'Current API : ' . $api . $this->lineBreak; return false; } protected function assertOS() { $os = php_uname("s"); foreach ($this->expectedOS as $expectedOS) { if ( false !== stripos($os, $expectedOS)) { return true; } } echo 'Current OS : ' . $os . $this->lineBreak; return false; } protected function assertArchitecture() { $archi = php_uname("m"); foreach ($this->expectedArchitecture as $expectedArchitecture) { if (0 == strcasecmp($archi, $expectedArchitecture)) { return true; } } echo 'Current Architecture : ' . $archi . $this->lineBreak; return false; } protected function assertPhpVersion() { $return = true; if (!is_null(self::MIN_ALLOWED_PHP_VERSION)) { $return = version_compare(PHP_VERSION, self::MIN_ALLOWED_PHP_VERSION, '>='); } if (!is_null(self::MAX_ALLOWED_PHP_VERSION)) { $return = $return && version_compare(PHP_VERSION, self::MAX_ALLOWED_PHP_VERSION, '<'); } if(!$return) { echo 'Current PHP version : ' . phpversion() . $this->lineBreak; } return $return; } protected function assertMemory() { $mem = intval(ini_get('memory_limit')); $min = constant('self::MIN_ALLOWED_MEMORY' . $this->apiSuffix); $max = constant('self::MAX_ALLOWED_MEMORY' . $this->apiSuffix); $return = true; if (!is_null($min)) { $return = $mem >= $min; } if (!is_null($max)) { $return = $return && ($mem <= $max); } if(!$return) { echo 'Current memory : ' . $mem . $this->lineBreak; } return $return; } protected function assertExecutionTime() { $time = ini_get('max_execution_time'); $time = (0 != $time) ? $time : PHP_INT_MAX; $min = constant('self::MIN_ALLOWED_EXECUTION_TIME' . $this->apiSuffix); $max = constant('self::MAX_ALLOWED_EXECUTION_TIME' . $this->apiSuffix); $return = true; if (!is_null($min)) { $return = $time >= $max; } if (!is_null($max)) { $return = $time && ($mem <= $max); } if(!$return) { echo 'Current execution time : ' . $time . $this->lineBreak; } return $return; } protected function assertApacheModules() { if (!function_exists('apache_get_modules')) {//By-pass return true; } $modules = apache_get_modules(); foreach ($this->expectedApacheModules as $expectedApacheModule) { if (!in_array($expectedApacheModule, $modules)) { echo 'Missing module : ' . $expectedApacheModule . $this->lineBreak; return false; } } return true; } protected function assertExtensions() { $extensions = get_loaded_extensions(); foreach ($this->expectedExtensions as $expectedExtension) { if (!in_array($expectedExtension, $extensions)) { echo 'Missing extension : ' . $expectedExtension . $this->lineBreak; return false; } } return true; } } //Launch check return ((new CheckPlateform())->execute() ? 0 : -1);

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)
7.2.00.0080.00819.43
7.1.100.0060.00618.00
7.1.70.0000.00717.24
7.1.60.0090.01519.32
7.1.50.0100.01316.82
7.1.00.0030.07722.44
7.0.200.0070.00016.66
7.0.140.0070.07322.10
7.0.100.0070.04020.25
7.0.90.0130.03320.05
7.0.80.0000.04320.06
7.0.70.0070.04020.04
7.0.60.0030.04320.01
7.0.50.0070.03720.38
7.0.40.0070.03020.05
7.0.30.0070.03020.13
7.0.20.0030.03720.04
7.0.10.0000.04720.05
7.0.00.0070.03720.04
5.6.250.0100.03320.81
5.6.240.0030.04320.81
5.6.230.0000.03720.72
5.6.220.0070.04020.64
5.6.210.0030.04020.70
5.6.200.0030.04321.12
5.6.190.0070.03321.07
5.6.180.0070.03721.19
5.6.170.0070.03320.98
5.6.160.0070.03721.18
5.6.150.0070.04321.19
5.6.140.0070.03721.06
5.6.130.0030.08720.97
5.6.120.0070.08721.18
5.6.110.0070.08021.00
5.6.100.0030.05721.14
5.6.90.0100.08320.98
5.6.80.0030.07720.45
5.6.70.0100.08020.50
5.6.60.0170.06720.44
5.6.50.0030.03720.46
5.6.40.0100.07720.36
5.6.30.0030.07720.54
5.6.20.0030.05720.48
5.6.10.0030.03720.36
5.6.00.0070.08020.47
5.5.380.0030.04720.40
5.5.370.0070.03720.40
5.5.360.0100.03720.44
5.5.350.0100.03720.50
5.5.340.0030.03320.91
5.5.330.0070.03020.95
5.5.320.0070.04020.96
5.5.310.0130.02720.83
5.5.300.0100.03020.69
5.5.290.0170.07320.77
5.5.280.0030.07720.94
5.5.270.0130.05020.77
5.5.260.0100.07720.93
5.5.250.0130.07020.76
5.5.240.0030.05720.23
5.5.230.0030.08720.20
5.5.220.0100.03020.32
5.5.210.0130.06720.25
5.5.200.0000.08020.27
5.5.190.0100.03720.22
5.5.180.0100.06320.29
5.5.160.0100.06720.18
5.5.150.0100.04020.13
5.5.140.0100.07720.29
5.5.130.0030.07320.12
5.5.120.0100.08020.25
5.5.110.0030.08320.28
5.5.100.0000.04320.15
5.5.90.0100.07720.09
5.5.80.0070.06020.20
5.5.70.0130.06320.02
5.5.60.0030.05020.08
5.5.50.0030.07020.09
5.5.40.0070.07319.98
5.5.30.0070.07019.97
5.5.20.0100.07020.18
5.5.10.0030.05020.12
5.5.00.0070.08720.09
5.4.450.0000.04319.29
5.4.440.0000.07719.19
5.4.430.0070.06319.21
5.4.420.0070.09319.53
5.4.410.0130.04319.38
5.4.400.0070.06019.08
5.4.390.0030.07019.07
5.4.380.0070.06719.12
5.4.370.0070.03319.05
5.4.360.0130.07019.13
5.4.350.0030.06719.04
5.4.340.0070.06719.04
5.4.320.0000.08719.21
5.4.310.0100.06719.05
5.4.300.0030.05719.18
5.4.290.0070.04319.02
5.4.280.0130.07719.13
5.4.270.0100.07019.16
5.4.260.0070.07019.03
5.4.250.0030.08318.87
5.4.240.0070.07318.84
5.4.230.0000.09719.09
5.4.220.0000.05318.90
5.4.210.0030.07019.10
5.4.200.0030.03719.04
5.4.190.0030.06019.20
5.4.180.0030.03719.03
5.4.170.0200.05319.01
5.4.160.0100.05019.02
5.4.150.0030.03719.07
5.4.140.0070.08316.20
5.4.130.0030.03316.44
5.4.120.0030.06716.31
5.4.110.0070.07016.47
5.4.100.0100.05016.51
5.4.90.0100.03016.54
5.4.80.0070.08016.51
5.4.70.0030.03316.43
5.4.60.0030.07716.42
5.4.50.0070.07016.37
5.4.40.0070.07016.50
5.4.30.0100.02716.46
5.4.20.0070.07316.45
5.4.10.0100.07316.45
5.4.00.0030.06715.89
5.3.290.0100.08014.86
5.3.280.0030.06014.66
5.3.270.0100.03014.59
5.3.260.0070.07714.75
5.3.250.0000.05014.60
5.3.240.0100.07314.58
5.3.230.0100.07314.77
5.3.220.0030.08014.74
5.3.210.0100.06714.55
5.3.200.0030.07314.71
5.3.190.0070.05014.55
5.3.180.0030.07714.76
5.3.170.0000.08714.61
5.3.160.0070.04314.64
5.3.150.0030.03714.54
5.3.140.0100.06314.66
5.3.130.0070.07314.74
5.3.120.0100.03014.59
5.3.110.0130.04714.55
5.3.100.0070.04714.10
5.3.90.0070.07314.21
5.3.80.0100.05714.21
5.3.70.0070.07714.06
5.3.60.0000.08014.16
5.3.50.0030.06314.07
5.3.40.0170.04313.98
5.3.30.0030.07714.08
5.3.20.0100.07013.74
5.3.10.0030.04313.75
5.3.00.0070.04013.71

preferences:
32.63 ms | 400 KiB | 5 Q