3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Example; function substr_replace( array|string $string, array|string $replace, array|int|null $offset, array|int|null $length = null ): string|array { if ( $offset === null ) { $offset = is_string($string) ? strlen($string) : array_map(strlen(...), $string); } return \substr_replace($string, $replace, $offset, $length); } $foo = substr_replace('abc', 'xyz', null); var_dump($foo); $foo = substr_replace(['hello', 'goodbye'], '!', null); var_dump($foo); $foo = substr_replace(['one', 'two'], [' - uno', ' - dos'], null); var_dump($foo);

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.4.120.0110.00924.02
8.4.110.0060.00320.56
8.4.100.0090.01118.85
8.4.90.0090.01120.74
8.4.80.0120.00718.72
8.4.70.0040.00417.89
8.4.60.0120.00918.87
8.4.50.0080.01218.52
8.4.40.0070.01319.39
8.4.30.0140.00719.04
8.4.20.0090.00219.25
8.4.10.0100.00019.34
8.3.250.0120.00719.00
8.3.240.0130.00616.98
8.3.230.0050.00516.38
8.3.220.0010.00718.73
8.3.210.0040.00418.20
8.3.200.0040.00516.59
8.3.190.0080.01116.75
8.3.180.0110.00617.13
8.3.170.0060.00318.94
8.3.160.0040.00417.30
8.3.150.0060.00317.19
8.3.140.0000.00816.56
8.3.130.0000.01018.31
8.3.120.0060.00318.87
8.3.110.0070.00022.58
8.3.100.0080.00820.94
8.3.90.0030.00620.94
8.3.50.0030.00720.94
8.3.40.0110.01121.47
8.3.30.0060.01320.70
8.3.20.0090.00623.65
8.3.10.0170.00323.66
8.3.00.0080.00818.79
8.2.290.0090.01020.50
8.2.280.0100.00618.64
8.2.270.0080.00017.29
8.2.260.0040.01116.72
8.2.250.0030.00516.59
8.2.240.0040.00418.84
8.2.230.0030.00620.94
8.2.220.0040.00422.58
8.2.210.0000.00922.58
8.2.170.0210.00018.78
8.2.160.0070.01419.89
8.2.150.0130.00319.20
8.2.140.0130.00720.38
8.2.130.0030.01220.38
8.2.120.0130.00619.14
8.2.110.0200.00019.27
8.2.100.0130.00619.27
8.2.90.0060.00918.84
8.2.80.0150.00019.40
8.2.70.0060.00918.64
8.2.60.0170.00018.63
8.2.50.0070.01019.02
8.2.40.0060.01218.88
8.2.30.0070.01118.70
8.2.20.0100.01018.70
8.2.10.0120.00618.74
8.2.00.0110.01118.40
8.1.330.0120.00622.00
8.1.320.0110.00816.11
8.1.310.0110.00318.46
8.1.300.0090.00620.14
8.1.270.0150.00621.85
8.1.260.0100.01021.85
8.1.250.0100.01022.09
8.1.240.0160.00318.38
8.1.230.0130.00718.50
8.1.220.0110.00718.82
8.1.210.0100.01018.42
8.1.200.0150.00918.62
8.1.190.0100.00718.59
8.1.180.0100.00718.28
8.1.170.0120.00318.69
8.1.160.0040.01218.36
8.1.150.0120.00318.79
8.1.140.0040.01218.73
8.1.130.0120.00318.73
8.1.120.0060.00918.38
8.1.110.0090.00618.43
8.1.100.0060.00919.78
8.1.90.0060.00918.56
8.1.80.0120.00319.73
8.1.70.0140.00318.59
8.1.60.0070.01118.45
8.1.50.0140.00418.34
8.1.40.0120.00318.61
8.1.30.0070.00718.81
8.1.20.0090.00619.80
8.1.10.0040.01118.63
8.1.00.0090.00618.36

preferences:
28.62 ms | 403 KiB | 5 Q