3v4l.org

run code in 300+ PHP versions simultaneously
<?php function debug($variable) { ob_start(); var_dump($variable); $output = ob_get_clean(); $maps = [ 'string' => "/(string\((?P<length>\d+)\)) (?P<value>\"(?<!\\\).*\")/i", 'array' => "/\[\"(?P<key>.+)\"(?:\:\"(?P<class>[a-z0-9_\\\]+)\")?(?:\:(?P<scope>public|protected|private))?\]=>/Ui", 'countable' => "/(?P<type>array|int|string)\((?P<count>\d+)\)/", 'resource' => "/resource\((?P<count>\d+)\) of type \((?P<class>[a-z0-9_\\\]+)\)/", 'bool' => "/bool\((?P<value>true|false)\)/", 'float' => "/float\((?P<value>[0-9\.]+)\)/", 'object' => "/object\((?P<class>\S+)\)\#(?P<id>\d+) \((?P<count>\d+)\)/i" ]; foreach ($maps as $function => $pattern) { $output = preg_replace_callback($pattern, function ($matches) use ($function) { switch ($function) { case 'string': $matches['value'] = htmlspecialchars($matches['value']); return '<span style="color: #0000FF;">string</span>(<span style="color: #1287DB;">' . $matches['length'] . ')</span> <span style="color: #6B6E6E;">' . $matches['value'] . '</span>'; case 'array': $key = '<span style="color: #008000;">"' . $matches['key'] . '"</span>'; $class = ''; $scope = ''; if (isset($matches['class']) && !empty($matches['class'])) { $class = ':<span style="color: #4D5D94;">"' . $matches['class'] . '"</span>'; } if (isset($matches['scope']) && !empty($matches['scope'])) { $scope = ':<span style="color: #666666;">' . $matches['scope'] . '</span>'; } return '[' . $key . $class . $scope . ']=>'; case 'countable': $type = '<span style="color: #0000FF;">' . $matches['type'] . '</span>'; $count = '(<span style="color: #1287DB;">' . $matches['count'] . '</span>)'; return $type . $count; case 'bool': return '<span style="color: #0000FF;">bool</span>(<span style="color: #0000FF;">' . $matches['value'] . '</span>)'; case 'float': return '<span style="color: #0000FF;">float</span>(<span style="color: #1287DB;">' . $matches['value'] . '</span>)'; case 'resource': return '<span style="color: #0000FF;">resource</span>(<span style="color: #1287DB;">' . $matches['count'] . '</span>) of type (<span style="color: #4D5D94;">' . $matches['class'] . '</span>)'; case 'object': return '<span style="color: #0000FF;">object</span>(<span style="color: #4D5D94;">' . $matches['class'] . '</span>)#' . $matches['id'] . ' (<span style="color: #1287DB;">' . $matches['count'] . '</span>)'; } }, $output); } $header = ''; list($debugfile) = debug_backtrace(); if (!empty($debugfile['file'])) { $header = '<h4 style="border-bottom:1px solid #bbb;font-weight:bold;margin:0 0 10px 0;padding:3px 0 10px 0">' . $debugfile['file'] . '</h4>'; } echo '<pre style="background-color: #CDDCF4;border: 1px solid #bbb;border-radius: 4px;-moz-border-radius:4px;-webkit-border-radius\:4px;font-size:12px;line-height:1.4em;margin:30px;padding:7px">' . $header . $output . '</pre>'; } debug(['foo', 'bar', 'baz', 42]);

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.0160.00618.40
8.3.50.0070.01116.45
8.3.40.0160.00619.07
8.3.30.0100.00718.97
8.3.20.0040.00421.73
8.3.10.0040.00423.52
8.3.00.0040.00419.80
8.2.180.0150.00716.88
8.2.170.0070.00722.96
8.2.160.0070.00719.46
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0060.00320.64
8.2.120.0050.00326.35
8.2.110.0070.00319.43
8.2.100.0040.00818.16
8.2.90.0060.00318.21
8.2.80.0080.00019.23
8.2.70.0040.00417.88
8.2.60.0040.00417.88
8.2.50.0000.00818.28
8.2.40.0040.00422.39
8.2.30.0040.00419.67
8.2.20.0060.00318.15
8.2.10.0080.00417.95
8.2.00.0050.00218.30
8.1.280.0120.00925.92
8.1.270.0030.00523.96
8.1.260.0060.01226.35
8.1.250.0060.00328.09
8.1.240.0060.00322.33
8.1.230.0090.00321.09
8.1.220.0000.00817.74
8.1.210.0090.00019.16
8.1.200.0090.00017.60
8.1.190.0000.00817.60
8.1.180.0080.00018.10
8.1.170.0030.00518.75
8.1.160.0000.00718.99
8.1.150.0030.00520.32
8.1.140.0040.00417.72
8.1.130.0050.00217.70
8.1.120.0040.00417.75
8.1.110.0030.00617.59
8.1.100.0000.00717.58
8.1.90.0000.00717.71
8.1.80.0070.00017.68
8.1.70.0040.00417.57
8.1.60.0030.00517.78
8.1.50.0000.00817.73
8.1.40.0050.00317.71
8.1.30.0030.00617.89
8.1.20.0080.00017.78
8.1.10.0040.00417.71
8.1.00.0000.01017.63
8.0.300.0040.00420.25
8.0.290.0050.00316.88
8.0.280.0030.00318.46
8.0.270.0000.00717.05
8.0.260.0040.00416.96
8.0.250.0000.00717.25
8.0.240.0030.00517.23
8.0.230.0000.00717.20
8.0.220.0040.00417.13
8.0.210.0040.00417.02
8.0.200.0080.00017.09
8.0.190.0050.00217.07
8.0.180.0000.00717.13
8.0.170.0060.00317.11
8.0.160.0000.00717.11
8.0.150.0000.00716.89
8.0.140.0000.00717.02
8.0.130.0000.00613.50
8.0.120.0080.00017.11
8.0.110.0000.00816.99
8.0.100.0040.00417.01
8.0.90.0000.00717.08
8.0.80.0120.00317.20
8.0.70.0000.00817.02
8.0.60.0050.00317.04
8.0.50.0030.00517.18
8.0.30.0130.00817.29
8.0.20.0090.01017.40
8.0.10.0050.00317.11
8.0.00.0080.01117.22
7.4.330.0000.00515.55
7.4.320.0030.00316.91
7.4.300.0000.00716.88
7.4.290.0030.00316.89
7.4.280.0000.00816.89
7.4.270.0050.00216.92
7.4.260.0080.00016.93
7.4.250.0050.00316.84
7.4.240.0040.00416.89
7.4.230.0000.00716.98
7.4.220.0040.00416.77
7.4.210.0100.00717.01
7.4.200.0040.00416.70
7.4.160.0090.00716.61
7.4.140.0120.00917.86
7.4.130.0150.00316.76
7.4.120.0110.00916.77
7.4.110.0090.01516.84
7.4.100.0060.01216.73
7.4.90.0080.00816.86
7.4.80.0130.01319.39
7.4.70.0070.01116.78
7.4.60.0070.01016.76
7.4.50.0030.01416.86
7.4.40.0080.00816.70
7.4.00.0060.01215.11
7.3.330.0050.00013.41
7.3.320.0030.00313.57
7.3.310.0040.00416.62
7.3.300.0030.00316.48
7.3.290.0070.00316.65
7.3.280.0110.00716.57
7.3.260.0110.01216.82
7.3.240.0090.01016.68
7.3.230.0060.01216.83
7.3.210.0060.00916.84
7.3.200.0070.01516.83
7.3.190.0000.01616.55
7.3.180.0110.00516.42
7.3.170.0100.00716.94
7.3.160.0090.00917.08
7.3.120.0060.01315.34
7.3.110.0030.01515.04
7.3.100.0070.00715.19
7.3.90.0100.00615.08
7.3.80.0140.00015.39
7.3.70.0100.00715.23
7.3.60.0060.00315.12
7.3.50.0040.01114.95
7.3.40.0090.00915.17
7.3.30.0120.00314.96
7.3.20.0080.00816.74
7.3.10.0140.00916.68
7.3.00.0070.00716.81
7.2.330.0100.01017.03
7.2.320.0090.00916.88
7.2.310.0100.00717.07
7.2.300.0130.01016.95
7.2.290.0040.01416.94
7.2.250.0090.00715.27
7.2.240.0090.01215.29
7.2.230.0030.00915.39
7.2.220.0030.01015.53
7.2.210.0030.01215.40
7.2.200.0040.01115.13
7.2.190.0030.01015.24
7.2.180.0080.00615.13
7.2.170.0000.01015.22
7.2.130.0180.00917.10
7.2.120.0110.01116.68
7.2.110.0230.00516.78
7.2.100.0230.00417.12
7.2.90.0170.01117.07
7.2.80.0110.01116.90
7.2.70.0150.01516.75
7.2.60.0120.00817.04
7.2.50.0210.00316.66
7.2.40.0110.00416.59
7.2.30.0090.01317.89
7.2.20.0120.01417.76
7.2.10.0150.01217.66
7.2.00.0110.01017.96
7.1.330.0100.00616.06
7.1.320.0030.01016.20
7.1.310.0070.00716.03
7.1.300.0030.00916.16
7.1.290.0110.00715.82
7.1.280.0030.00615.99
7.1.270.0150.00315.91
7.1.260.0000.01016.20
7.1.250.0180.00715.50
7.1.200.0160.00815.86
7.1.150.0110.01217.01
7.1.140.0120.01317.04
7.1.130.0130.01217.19
7.1.120.0170.01017.06
7.1.110.0150.01116.57
7.1.100.0140.01216.66
7.1.90.0110.00916.71
7.1.80.0110.01016.49
7.1.70.0110.00815.77
7.1.60.0280.01233.24
7.1.50.0260.01133.01
7.1.40.0280.01532.37
7.1.30.0350.01532.60
7.1.20.0300.01332.78
7.1.10.0120.01115.07
7.1.00.0100.00915.09

preferences:
57.43 ms | 400 KiB | 5 Q