3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DS { /* * Properties for logging in-loops */ private static $_variables = array(); private static $_arrays = array(); /* * Property for global data store */ private static $_globals = array(); private static $_constants = array(); private static $_objects = array(); /* * Properties for logging storage */ private static $_errors = array(); private static $_progress = array(); private static $_syse = array(); const LOGGING_PROGRESS_FILE_PREFIX = 'progress'; const LOGGING_ERRORS_FILE_PREFIX = 'errors'; const LOGGING_DEBUG_FILE_PREFIX = 'debug'; const LOGGING_KEYS_PER_WRITE = 100; const LOGGING_LINE_FORMAT = '%1$s - [%2$s/%3$s][%4$s] %5$s: %6$s'; const LOGGING_SYSE_LINE_FORMAT = '%1$s - [PHP %2$s ON %3$s:%4$s] - %5$s (%6$s)'; /* * Property for temporary storage */ private static $_tmp = array(); /* * Property for logging output */ private static $_log = array(); private static $_fbt = array(); public static function init() { //date folder // /* * Used for wiping data for in-loop stored data * ready for next iteration */ } /* * GENERAL LOGGING */ public static function L($section = 'general', $text = '', $type = 'progress', $kill = 0) { if (!empty($type) && !empty($title)) { self::$_fbt = self::FBT(debug_backtrace()); self::${"_$type"}[] = sprintf(self::LOGGING_LINE_FORMAT, date('dmY-His'), DS::G('CURRENT_TYPE'), DS::G('CURRENT_CRAWLER'), $section, self::$_fbt, $text ); if (count(self::${"_$type"}) >= self::LOGGING_KEYS_PER_WRITE) { self::logWrite($type); } } } public static function SYS_E($errno, $errstr, $errfile, $errline){ if (!$errno) return; switch ($errno) { case E_USER_ERROR: $type='ERROR'; break; case E_USER_WARNING: $type='WARNING'; break; case E_USER_NOTICE: $type='NOTICE'; break; default: $type='UNKNOWN'; break; } self::$_syse[] = sprintf(self::LOGGING_SYSE_LINE_FORMAT, date('dmY-His'), $type, $errfile, $errline, $errstr, $errno ); self::logWrite('syse'); return true; } private static function logWrite($type = '') { if (empty($type)) return false; $fh = fopen(DIR_LOG.date('Ymd').'-'.$type,'a'); foreach (self::${"_$type"} as $item) fwrite($fh,$text."\n"); fclose($fh); self::clearLogBuffer($type); } private static function FBT($fbt,$full=0) { $arr=array(); foreach($bt as $bti){ $arr[]= $bti['function']; } $arr=array_reverse($arr); array_pop($arr); return ($full===1 ? implode('->',$arr) : $arr[count($arr)-1]); } private static function clearLogBuffer($type) { self::${"_$type"} = array(); } /** * // GENERAL LOGGING */ /** * public static function loopReset() { self::$_variables = array(); self::$_arrays = array(); self::$_tmp = array(); self::$_log = array(); } /** * KEY - VALUE STORAGE */ public static function dump($title = '') { if (!empty($title)) { self::$_log[] = $title.' {'; self::$_log[] = ''; } foreach (array('variables','constants','arrays') as $varName) { self::$_log[] = "\t".strtoupper($varName); if (count(self::${"_$varName"}) > 0) { foreach (self::${"_$varName"} as $k => $v) { self::$_log[] = "\t\t".'$'.$k.' = '.self::inlinePrint($v); } } else { self::$_log[] = "\t\tnone"; } } if (!empty($title)) { self::$_log[] = ''; self::$_log[] = '}'; self::$_log[] = ''; } echo implode("\n",self::$_log); } public static function V($name,$val = '') { if (!self::setVal('variables',$name,$val)) return self::$_variables[$name]; } public static function C($name,$val = '') { if (!self::setVal('constants',$name,$val)) return self::$_constants[$name]; } public static function A($name,$array = '') { if (!self::setVal('arrays',$name,$array)) return self::$_arrays[$name]; } public static function G($name,$value) { if (!self::setVal('globals',$name,$value)) return self::$_globals[$name]; } public static function O($name,$value) { if (!self::setVal('objects',$name,$value)) return self::$_global[$name]; } private static function setVal($type,$name,$value) { if (!empty($type) && !empty($name) && !empty($value)) { if (strpos($name,':')!==false && in_array($type,array('arrays','globals'))) { foreach(explode(':',$arr) as $split) $conv.= '[\''.$split.'\']'; if (empty($array)) { eval("return (isset(self::\$_$type$conv) ? self::\$_$type$conv : false);"); }else{ eval("self::\$_arrays$conv = \$array;"); } }else{ self::${"_$type"}[$name] = $value; return true; } } } private static function inlinePrint($data) { return str_replace(array("\n","\t"," "," "),' ',print_r($data,true)); } } DS::A('array1',array(1,2,3)); DS::C('constant1','doom'); DS::dump('prod #12343'); ?>

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.00616.63
8.3.50.0150.00721.93
8.3.40.0170.00318.87
8.3.30.0140.00719.26
8.3.20.0100.00320.33
8.3.10.0080.00021.85
8.3.00.0030.01019.69
8.2.180.0120.00318.52
8.2.170.0040.01122.96
8.2.160.0110.00419.38
8.2.150.0150.00424.18
8.2.140.0030.00524.66
8.2.130.0150.00326.16
8.2.120.0050.00320.57
8.2.110.0030.00619.47
8.2.100.0040.00819.53
8.2.90.0080.00019.30
8.2.80.0030.00518.05
8.2.70.0030.00617.88
8.2.60.0000.00918.18
8.2.50.0030.00618.07
8.2.40.0030.00618.59
8.2.30.0040.00418.11
8.2.20.0000.00917.86
8.2.10.0060.00318.10
8.2.00.0050.00317.75
8.1.280.0070.01425.92
8.1.270.0040.01123.96
8.1.260.0110.00026.35
8.1.250.0040.00428.09
8.1.240.0070.00321.01
8.1.230.0090.00319.26
8.1.220.0000.00817.89
8.1.210.0040.00418.77
8.1.200.0070.00317.48
8.1.190.0080.00017.76
8.1.180.0060.00318.10
8.1.170.0050.00318.40
8.1.160.0020.00522.03
8.1.150.0050.00319.04
8.1.140.0070.00017.66
8.1.130.0070.00017.87
8.1.120.0080.00017.61
8.1.110.0040.00417.50
8.1.100.0020.00517.49
8.1.90.0000.00717.56
8.1.80.0020.00517.49
8.1.70.0080.00017.48
8.1.60.0090.00017.71
8.1.50.0000.00817.52
8.1.40.0000.00917.59
8.1.30.0060.00317.69
8.1.20.0050.00317.73
8.1.10.0040.00417.72
8.1.00.0030.00517.57
8.0.300.0000.00718.77
8.0.290.0000.00717.30
8.0.280.0030.00318.47
8.0.270.0040.00317.36
8.0.260.0000.00717.29
8.0.250.0000.00716.96
8.0.240.0030.00316.94
8.0.230.0000.00716.97
8.0.220.0030.00317.04
8.0.210.0000.00717.03
8.0.200.0000.00717.05
8.0.190.0020.00516.97
8.0.180.0000.00717.06
8.0.170.0000.00816.86
8.0.160.0070.00016.97
8.0.150.0040.00416.96
8.0.140.0050.00216.78
8.0.130.0030.00613.44
8.0.120.0080.00016.86
8.0.110.0060.00316.95
8.0.100.0030.00616.86
8.0.90.0050.00316.90
8.0.80.0030.01317.03
8.0.70.0040.00417.11
8.0.60.0000.00716.95
8.0.50.0080.00017.04
8.0.30.0110.01217.15
8.0.20.0140.00517.40
8.0.10.0000.00817.05
8.0.00.0080.01016.80
7.4.330.0000.00615.13
7.4.320.0000.00716.61
7.4.300.0030.00316.75
7.4.290.0030.00316.62
7.4.280.0060.00316.54
7.4.270.0030.00316.63
7.4.260.0040.00416.55
7.4.250.0050.00316.66
7.4.240.0020.00516.72
7.4.230.0070.00016.54
7.4.220.0100.01316.75
7.4.210.0110.00716.57
7.4.200.0040.00416.65
7.4.160.0080.00816.41
7.4.150.0110.00717.40
7.4.140.0070.01017.86
7.4.130.0110.00616.66
7.4.120.0080.00916.68
7.4.110.0090.00916.75
7.4.100.0070.01016.43
7.4.90.0100.00716.79
7.4.80.0070.01119.39
7.4.70.0100.01016.56
7.4.60.0070.01016.84
7.4.50.0080.00016.70
7.4.40.0150.00316.50
7.4.30.0120.00916.69
7.4.10.0100.01014.86
7.4.00.0040.01215.04
7.3.330.0000.00513.49
7.3.320.0030.00313.34
7.3.310.0030.00316.52
7.3.300.0030.00316.51
7.3.290.0050.00916.47
7.3.280.0080.00816.45
7.3.270.0060.01117.40
7.3.260.0080.01216.52
7.3.250.0110.00616.59
7.3.240.0130.01016.41
7.3.230.0100.01416.63
7.3.210.0130.00716.53
7.3.200.0130.01019.39
7.3.190.0060.01616.55
7.3.180.0030.01216.79
7.3.170.0030.01416.69
7.3.160.0130.00316.48
7.3.130.0070.01014.98
7.3.120.0060.01115.05
7.3.110.0040.01515.06
7.3.100.0070.00815.05
7.3.90.0080.00614.95
7.3.80.0000.01214.78
7.3.70.0030.01114.87
7.3.60.0120.00414.85
7.3.50.0060.00515.00
7.3.40.0010.01215.04
7.3.30.0030.01514.72
7.3.20.0060.00716.57
7.3.10.0040.00416.58
7.3.00.0030.00916.56
7.2.330.0090.00916.62
7.2.320.0060.01216.53
7.2.310.0040.01316.82
7.2.300.0100.00716.52
7.2.290.0070.01016.54
7.2.260.0070.01015.29
7.2.250.0050.01115.28
7.2.240.0030.01015.25
7.2.230.0060.01115.09
7.2.220.0100.00715.09
7.2.210.0050.00915.24
7.2.200.0050.00915.23
7.2.190.0040.01215.22
7.2.180.0060.00515.01
7.2.170.0060.00915.19
7.2.160.0080.00414.97
7.2.150.0030.01017.02
7.2.140.0030.01017.04
7.2.130.0080.00616.75
7.2.120.0110.00417.01
7.2.110.0060.00316.91
7.2.100.0040.00816.72
7.2.90.0060.00917.03
7.2.80.0120.00316.95
7.2.70.0040.01116.90
7.2.60.0030.00616.95
7.2.50.0100.00716.95
7.2.40.0060.01116.85
7.2.30.0070.00616.63
7.2.20.0070.00717.10
7.2.10.0000.01416.76
7.2.00.0040.00718.05
7.1.330.0070.00515.89
7.1.320.0040.00615.83
7.1.310.0090.00715.76
7.1.300.0070.00915.78
7.1.290.0030.00815.78
7.1.280.0090.00815.73
7.1.270.0060.00815.60
7.1.260.0020.00915.69
7.1.250.0000.01315.84
7.1.240.0040.00815.91
7.1.230.0060.00616.01
7.1.220.0030.00616.02
7.1.210.0110.00315.62
7.1.200.0070.00715.91
7.1.190.0040.01115.77
7.1.180.0060.00615.68
7.1.170.0070.00715.89
7.1.160.0090.00415.81
7.1.150.0060.00615.73
7.1.140.0000.01515.76
7.1.130.0040.01215.93
7.1.120.0030.00615.89
7.1.110.0100.00015.58
7.1.100.0030.00916.88
7.1.90.0080.00515.86
7.1.80.0040.00815.67
7.1.70.0080.00516.40
7.1.60.0070.01317.57
7.1.50.0070.01725.37
7.1.40.0030.00715.99
7.1.30.0000.01415.77
7.1.20.0060.00615.84
7.1.10.0070.00715.64
7.1.00.0040.04219.10
7.0.330.0100.00315.34
7.0.320.0040.00715.29
7.0.310.0070.01015.46
7.0.300.0090.00615.04
7.0.290.0030.00915.52
7.0.280.0040.01115.52
7.0.270.0030.01015.58
7.0.260.0040.00715.43
7.0.250.0040.00815.20
7.0.240.0120.00315.24
7.0.230.0030.00715.21
7.0.220.0070.00715.41
7.0.210.0040.01415.44
7.0.200.0370.00715.18
7.0.190.0000.01215.20
7.0.180.0060.00615.23
7.0.170.0060.00915.54
7.0.160.0040.00415.55
7.0.150.0120.00615.45
7.0.140.0060.04118.72
7.0.130.0090.00615.61
7.0.120.0100.00315.42
7.0.110.0030.00915.29
7.0.100.0070.00715.43
7.0.90.0070.00415.38
7.0.80.0050.04517.81
7.0.70.0140.04017.77
7.0.60.0100.02617.80
7.0.50.0070.02917.88
7.0.40.0100.04216.75
7.0.30.0090.04216.79
7.0.20.0060.03216.78
7.0.10.0100.04016.66
7.0.00.0110.04016.78
5.6.400.0060.00614.76
5.6.390.0040.00814.57
5.6.380.0030.00614.74
5.6.370.0070.01114.61
5.6.360.0030.00614.61
5.6.350.0030.00514.71
5.6.340.0040.01114.66
5.6.330.0030.00714.78
5.6.320.0030.01014.54
5.6.310.0130.00314.45
5.6.300.0000.00914.61
5.6.290.0040.00414.48
5.6.280.0060.03817.78
5.6.270.0040.00814.85
5.6.260.0030.00614.72
5.6.250.0090.00014.38
5.6.240.0030.01014.73
5.6.230.0020.04517.55
5.6.220.0070.03617.56
5.6.210.0030.04817.69
5.6.200.0050.03817.98
5.6.190.0130.04117.77
5.6.180.0070.04417.83
5.6.170.0110.04317.84
5.6.160.0100.04517.79
5.6.150.0080.04017.93
5.6.140.0100.02717.96
5.6.130.0130.03517.80
5.6.120.0070.02817.66
5.6.110.0050.03617.84
5.6.100.0080.03717.69
5.6.90.0100.02317.71
5.6.80.0090.04217.46
5.6.70.0050.04017.42
5.6.60.0020.03817.42
5.6.50.0130.02017.49
5.6.40.0070.04217.53
5.6.30.0060.03317.61
5.6.20.0080.04517.45
5.6.10.0080.04317.55
5.6.00.0080.02817.47
5.5.380.0070.00714.15
5.5.370.0080.02817.60
5.5.360.0150.03217.44
5.5.350.0080.03817.56
5.5.340.0020.04117.74
5.5.330.0090.03617.73
5.5.320.0030.04717.85
5.5.310.0100.04317.79
5.5.300.0070.04217.61
5.5.290.0070.04517.78
5.5.280.0030.03217.72
5.5.270.0110.03517.62
5.5.260.0110.02117.72
5.5.250.0020.02717.61
5.5.240.0070.04017.44
5.5.230.0090.03617.46
5.5.220.0080.03817.09
5.5.210.0080.02317.23
5.5.200.0070.03017.52
5.5.190.0050.02917.25
5.5.180.0080.03017.14
5.5.170.0100.00714.53
5.5.160.0050.05017.28
5.5.150.0100.03817.17
5.5.140.0090.03917.24
5.5.130.0100.03317.47
5.5.120.0090.03217.28
5.5.110.0050.04717.34
5.5.100.0050.03717.27
5.5.90.0080.02717.11
5.5.80.0050.02617.35
5.5.70.0130.03817.25
5.5.60.0020.03417.32
5.5.50.0050.02917.22
5.5.40.0060.02417.19
5.5.30.0060.02317.10
5.5.20.0030.03817.22
5.5.10.0070.03517.23
5.5.00.0080.02517.30
5.4.450.0060.04515.72
5.4.440.0090.04015.80
5.4.430.0050.04115.79
5.4.420.0090.03715.75
5.4.410.0070.03915.64
5.4.400.0070.03815.64
5.4.390.0050.04215.63
5.4.380.0040.02615.64
5.4.370.0060.02515.70
5.4.360.0100.03215.65
5.4.350.0020.03315.69
5.4.340.0030.04215.71
5.4.330.0000.00912.24
5.4.320.0030.02615.73
5.4.310.0110.03315.69
5.4.300.0070.02515.66
5.4.290.0080.03515.74
5.4.280.0120.03715.64
5.4.270.0090.03415.68
5.4.260.0080.02815.54
5.4.250.0060.03915.66
5.4.240.0130.03515.64
5.4.230.0020.02615.63
5.4.220.0050.04515.68
5.4.210.0110.03815.55
5.4.200.0050.04015.69
5.4.190.0080.03815.70
5.4.180.0050.03215.63
5.4.170.0080.02115.68
5.4.160.0050.02215.67
5.4.150.0070.02415.62
5.4.140.0000.02614.38
5.4.130.0000.04614.35
5.4.120.0050.03514.37
5.4.110.0050.02714.28
5.4.100.0050.02214.33
5.4.90.0050.03714.31
5.4.80.0110.03314.38
5.4.70.0070.03914.27
5.4.60.0020.03914.33
5.4.50.0070.04014.30
5.4.40.0050.03614.36
5.4.30.0070.04114.35
5.4.20.0000.02914.30
5.4.10.0040.02714.35
5.4.00.0050.03914.08

preferences:
57.02 ms | 401 KiB | 5 Q