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 = ''; [$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.0040.01118.68
8.3.50.0040.01516.64
8.3.40.0090.01318.93
8.3.30.0040.01218.91
8.3.20.0080.00021.77
8.3.10.0000.00923.56
8.3.00.0090.00019.56
8.2.180.0090.00616.98
8.2.170.0150.00622.96
8.2.160.0090.00619.46
8.2.150.0030.00524.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0050.00321.09
8.2.110.0090.00021.27
8.2.100.0140.00018.09
8.2.90.0000.00818.09
8.2.80.0000.00818.15
8.2.70.0000.00918.29
8.2.60.0000.00818.00
8.2.50.0000.00818.28
8.2.40.0050.00322.27
8.2.30.0040.00419.65
8.2.20.0040.00418.28
8.2.10.0080.00417.96
8.2.00.0000.00818.29
8.1.280.0210.00025.92
8.1.270.0050.00324.04
8.1.260.0080.00026.35
8.1.250.0040.01128.09
8.1.240.0030.00622.50
8.1.230.0110.00021.02
8.1.220.0030.00617.78
8.1.210.0040.00418.77
8.1.200.0000.00817.73
8.1.190.0000.00817.38
8.1.180.0000.00818.10
8.1.170.0040.00418.89
8.1.160.0030.00519.04
8.1.150.0000.00820.37
8.1.140.0000.00817.76
8.1.130.0000.00719.12
8.1.120.0030.00617.69
8.1.110.0000.01117.59
8.1.100.0040.00417.70
8.1.90.0040.00417.65
8.1.80.0000.00717.52
8.1.70.0030.00317.60
8.1.60.0080.00017.84
8.1.50.0040.00417.65
8.1.40.0030.00517.71
8.1.30.0050.00317.80
8.1.20.0030.00517.89
8.1.10.0000.00817.82
8.1.00.0060.00317.69
8.0.300.0030.00620.15
8.0.290.0040.00417.00
8.0.280.0030.00318.59
8.0.270.0040.00417.32
8.0.260.0000.00717.11
8.0.250.0030.00317.21
8.0.240.0050.00217.20
8.0.230.0000.00717.20
8.0.220.0030.00517.11
8.0.210.0070.00017.14
8.0.200.0040.00417.21
8.0.190.0070.00017.28
8.0.180.0000.00717.04
8.0.170.0000.00817.12
8.0.160.0020.00517.14
8.0.150.0000.00817.14
8.0.140.0000.00717.02
8.0.130.0000.00613.55
8.0.120.0000.00817.13
8.0.110.0050.00417.16
8.0.100.0050.00317.07
8.0.90.0050.00217.04
8.0.80.0100.00617.07
8.0.70.0040.00417.12
8.0.60.0040.00417.21
8.0.50.0040.00417.17
8.0.30.0090.01017.45
8.0.20.0070.01217.40
8.0.10.0040.00417.32
8.0.00.0090.01017.06
7.4.330.0050.00015.55
7.4.320.0030.00316.88
7.4.300.0000.00616.78
7.4.290.0030.00316.94
7.4.280.0090.00016.84
7.4.270.0000.00816.88
7.4.260.0040.00416.68
7.4.250.0080.00016.73
7.4.240.0000.00716.91
7.4.230.0040.00416.62
7.4.220.0030.00616.80
7.4.210.0080.00816.79
7.4.200.0040.00416.73
7.4.160.0100.00716.77
7.4.140.0110.01117.86
7.4.130.0120.00616.84
7.4.120.0090.01016.77
7.4.110.0060.01216.75
7.4.100.0060.01216.54
7.4.90.0070.01016.73
7.4.80.0090.01219.39
7.4.70.0100.01016.89
7.4.60.0070.01116.63
7.4.50.0000.01716.69
7.4.40.0090.00916.92
7.4.00.0070.00715.20
7.3.330.0000.00513.56
7.3.320.0070.00013.64
7.3.310.0000.00716.64
7.3.300.0030.00316.61
7.3.290.0050.00316.49
7.3.280.0120.00616.56
7.3.260.0080.01216.76
7.3.240.0100.00816.63
7.3.230.0110.00816.68
7.3.210.0090.00916.65
7.3.200.0110.00716.86
7.3.190.0100.00716.68
7.3.180.0070.01016.61
7.3.170.0030.01316.79
7.3.160.0070.01016.69
7.3.120.0100.00315.15
7.3.110.0030.01315.36
7.3.100.0040.00715.02
7.3.90.0050.00515.29
7.3.80.0080.00815.30
7.3.70.0130.00015.21
7.3.60.0060.00315.23
7.3.50.0070.01015.05
7.3.40.0040.01215.21
7.3.30.0030.00915.19
7.3.20.0040.01116.91
7.3.10.0040.01216.73
7.3.00.0020.01216.80
7.2.330.0100.01316.98
7.2.320.0070.01416.73
7.2.310.0080.01517.06
7.2.300.0140.00716.81
7.2.290.0150.00616.87
7.2.250.0090.00615.46
7.2.240.0070.01115.50
7.2.230.0060.00915.02
7.2.220.0070.00715.23
7.2.210.0050.00515.49
7.2.200.0000.01315.41
7.2.190.0040.01115.34
7.2.180.0000.01515.07
7.2.170.0030.01015.07
7.2.130.0040.01217.19
7.2.120.0040.01217.22
7.2.110.0000.01417.14
7.2.100.0060.00316.98
7.2.90.0030.01017.29
7.2.80.0090.00017.35
7.2.70.0030.00917.34
7.2.60.0100.00417.13
7.2.50.0060.00316.91
7.2.40.0000.01417.11
7.2.30.0100.00917.65
7.2.20.0090.01217.70
7.2.10.0090.01117.66
7.2.00.0110.00717.64
7.1.330.0060.00916.06
7.1.320.0030.01016.03
7.1.310.0000.01316.13
7.1.300.0030.01216.13
7.1.290.0030.00616.15
7.1.280.0040.01116.13
7.1.270.0030.00616.04
7.1.260.0080.00416.12
7.1.250.0030.01416.00
7.1.200.0100.00016.13
7.1.150.0110.01117.02
7.1.140.0120.01417.25
7.1.130.0100.01217.11
7.1.120.0060.01517.02
7.1.110.0080.01416.34
7.1.100.0100.01016.45
7.1.90.0130.01416.61
7.1.80.0140.00916.39
7.1.70.0090.01015.55
7.1.60.0280.01333.38
7.1.50.0320.01932.90
7.1.40.0320.01832.55
7.1.30.0260.01632.50
7.1.20.0740.01332.57
7.1.10.0110.00815.26
7.1.00.0090.01215.10

preferences:
64.43 ms | 400 KiB | 5 Q