3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "strlen ГРАЙ: " . strlen('ГРАЙ') . PHP_EOL; $mask = function ($name) { $length = strlen($name); return $name[0] . str_repeat('*', $length - 2) . $name[$length - 1]; }; echo "single-byte mask: " . $mask('ГРАЙ') . PHP_EOL; $grapheme_mask = function ($name) { $length = grapheme_strlen($name); return grapheme_substr($name, 0, 1) . str_repeat('*', $length - 2) . grapheme_substr($name, -1, 1); }; echo "grapheme mask: " . $grapheme_mask('ГРАЙ') . PHP_EOL; $mb_mask = function ($name) { $length = mb_strlen($name); return mb_substr($name, 0, 1) . str_repeat('*', $length - 2) . mb_substr($name, -1, 1); }; echo "mb mask: " . $mb_mask('ГРАЙ') . PHP_EOL;

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.80.0090.00319.36
8.3.70.0150.00317.75
8.3.60.0100.01317.50
8.3.50.0090.00918.98
8.3.40.0090.00619.64
8.3.30.0100.00519.79
8.3.20.0050.00324.18
8.3.10.0080.00024.66
8.3.00.0000.00826.16
8.2.200.0060.00618.88
8.2.190.0070.00718.00
8.2.180.0200.00325.92
8.2.170.0090.00920.00
8.2.160.0060.00922.96
8.2.150.0090.00025.66
8.2.140.0090.00024.66
8.2.130.0060.00326.16
8.2.120.0050.00326.35
8.2.110.0030.00621.32
8.2.100.0120.00018.78
8.2.90.0000.00818.75
8.2.80.0030.00619.78
8.2.70.0040.00418.63
8.2.60.0070.00419.01
8.2.50.0060.00318.75
8.2.40.0090.00021.01
8.2.30.0100.00019.06
8.2.20.0040.00419.16
8.2.10.0040.00420.26
8.2.00.0000.01020.44
8.1.290.0090.00030.84
8.1.280.0120.00925.92
8.1.270.0060.00323.99
8.1.260.0080.00028.09
8.1.250.0040.00428.09
8.1.240.0060.00319.89
8.1.230.0060.00618.89
8.1.220.0040.00418.54
8.1.210.0030.00518.77
8.1.200.0080.00418.25
8.1.190.0080.00018.22
8.1.180.0070.00318.35
8.1.170.0050.00519.56
8.1.160.0050.00519.92
8.1.150.0030.00619.88
8.1.140.0000.00819.85
8.1.130.0050.00321.15
8.1.120.0070.00318.36
8.1.110.0030.00618.38
8.1.100.0030.00718.48
8.1.90.0050.00518.48
8.1.80.0000.01118.36
8.1.70.0050.00518.45
8.1.60.0050.00318.64
8.1.50.0090.00318.49
8.1.40.0060.00618.57
8.1.30.0070.00318.66
8.1.20.0060.00618.57
8.1.10.0000.01018.48
8.1.00.0030.00718.52
8.0.300.0060.00318.77
8.0.290.0090.00017.75
8.0.280.0040.00419.58
8.0.270.0030.00519.08
8.0.260.0080.00019.55
8.0.250.0090.00017.86
8.0.240.0050.00317.75
8.0.230.0090.00017.93
8.0.220.0000.00817.85
8.0.210.0040.00417.84
8.0.200.0060.00317.77
8.0.190.0000.00917.88
8.0.180.0030.00717.88
8.0.170.0040.00817.86
8.0.160.0030.00717.78
8.0.150.0050.00517.85
8.0.140.0100.00317.79
8.0.130.0000.00613.43
8.0.120.0070.00317.73
8.0.110.0050.00218.04
8.0.100.0050.00317.83
8.0.90.0040.00417.96
8.0.80.0090.01217.94
8.0.70.0000.00717.88
8.0.60.0030.00518.01
8.0.50.0040.00417.68
8.0.30.0040.01717.79
8.0.20.0120.00817.88
8.0.10.0110.01117.94
8.0.00.0070.01017.91
7.4.330.0060.00015.55
7.4.320.0030.00317.44
7.4.300.0030.00617.44
7.4.290.0000.00917.51
7.4.280.0070.00717.36
7.4.270.0100.00017.40
7.4.260.0000.00513.29
7.4.250.0000.00717.34
7.4.240.0030.00717.52
7.4.230.0000.00717.50
7.4.220.0010.00617.55
7.4.210.0110.00617.50
7.4.200.0050.00317.39
7.4.160.0060.01017.44
7.4.150.0000.01717.45
7.4.140.0000.01817.47
7.4.130.0180.00917.35
7.4.120.0190.00517.48
7.4.110.0190.00817.47
7.4.100.0210.00417.61
7.4.90.0320.00017.42
7.4.80.0200.01217.55
7.4.70.0170.00717.39
7.4.60.0200.00817.39
7.4.50.0170.00917.24
7.4.40.0200.01017.24
7.4.30.0160.00817.41
7.4.20.0190.00717.39
7.4.10.0250.00017.36
7.4.00.0210.00417.49
7.3.330.0050.00517.41
7.3.320.0030.00313.41
7.3.310.0050.00217.40
7.3.300.0040.00417.41
7.3.290.0110.00617.35
7.3.280.0060.01217.43
7.3.270.0040.01217.37
7.3.260.0110.00617.32
7.3.250.0220.00417.36
7.3.240.0230.01017.42
7.3.230.0230.01017.37
7.3.220.0290.00417.37
7.3.210.0120.01617.34
7.3.200.0230.00317.25
7.3.190.0240.00317.28
7.3.180.0120.01517.29
7.3.170.0280.00517.33
7.3.160.0150.01217.26
7.3.150.0100.01517.25
7.3.140.0260.00717.32
7.3.130.0190.01417.27
7.3.120.0130.01317.34
7.3.110.0230.00417.16
7.3.100.0200.01017.09
7.3.90.0210.00717.67
7.3.80.0200.01217.30
7.3.70.0230.00317.32
7.3.60.0190.00817.45
7.3.50.0200.01017.55
7.3.40.0160.01117.54
7.3.30.0220.01317.48
7.3.20.0140.01517.45
7.3.10.1570.00617.35
7.3.00.0160.01117.43

preferences:
63.59 ms | 401 KiB | 5 Q