3v4l.org

run code in 300+ PHP versions simultaneously
<?php $emails = [ 'a@example.com', // output: a****a@example.com 'ab@example.com', // output: a****b@example.com 'abc@example.com', // output: a****c@example.com 'abcd@example.com', // output: a****d@example.com 'abcde@example.com', // output: a****e@example.com 'abcdef@example.com', // output: a****f@example.com 'abcdefg@example.com', // output: a*****g@example.com <- 5-asterisk-fill 'Ф@example.com', // output: Ф****Ф@example.com 'ФѰ@example.com', // output: Ф****Ѱ@example.com 'ФѰД@example.com', // output: Ф****Д@example.com 'ФѰДӐӘӔӺ@example.com', // output: Ф*****Ӻ@example.com <- 5-asterisk-fill '"a@tricky@one"@example.com', // output: "************"@example.com <- multiple @ in a valid email: no problem ]; $minFill = 4; $mask = preg_replace_callback( '/^(.)(.*?)([^@]?)(?=@[^@]+$)/u', fn($m) => $m[1] . str_repeat("*", max($minFill, mb_strlen($m[2], 'UTF-8'))) . ($m[3] ?: $m[1]), $emails ); var_export(array_combine($emails, $mask));

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.140.0120.01017.77
8.4.130.0130.00817.99
8.4.120.0130.00820.43
8.4.110.0160.00522.35
8.4.100.0160.00418.72
8.4.90.0140.00618.50
8.4.80.0120.01022.58
8.4.70.0120.00817.95
8.4.60.0180.00720.54
8.4.50.0120.01018.04
8.4.40.0080.00019.70
8.4.30.0060.00318.73
8.4.20.0170.00325.77
8.4.10.0130.00723.84
8.3.270.0100.01016.56
8.3.260.0100.01016.71
8.3.250.0070.00918.96
8.3.240.0160.00316.99
8.3.230.0060.00516.95
8.3.220.0040.00417.10
8.3.210.0090.00616.61
8.3.200.0040.00516.49
8.3.190.0090.00917.08
8.3.180.0120.00816.68
8.3.170.0120.00319.10
8.3.160.0150.00317.23
8.3.150.0060.01217.15
8.3.140.0030.00717.31
8.3.130.0080.00517.87
8.3.120.0220.00617.74
8.3.110.0170.00818.89
8.3.100.0170.00217.72
8.3.90.0090.00621.85
8.3.80.0150.00617.46
8.3.70.0190.00516.80
8.3.60.0200.01316.75
8.3.50.0250.00817.55
8.3.40.0140.00818.91
8.3.30.0190.00718.32
8.3.20.0230.00620.67
8.3.10.0140.00721.25
8.3.00.0130.00221.87
8.2.290.0080.01120.52
8.2.280.0040.00418.62
8.2.270.0090.00917.15
8.2.260.0040.00419.04
8.2.250.0190.00216.84
8.2.240.0210.00617.84
8.2.230.0210.00419.38
8.2.220.0200.00526.90
8.2.210.0200.00821.65
8.2.200.0190.00316.61
8.2.190.0180.00916.54
8.2.180.0190.01016.68
8.2.170.0260.00820.37
8.2.160.0190.00720.34
8.2.150.0160.00721.73
8.2.140.0260.00521.11
8.2.130.0230.00321.86
8.2.120.0140.01121.85
8.2.110.0190.00819.54
8.2.100.0220.00417.98
8.2.90.0140.00917.81
8.2.80.0200.00418.46
8.2.70.0160.00418.40
8.2.60.0090.00818.37
8.2.50.0100.00718.49
8.2.40.0150.00518.35
8.2.30.0140.00718.41
8.2.20.0130.00818.31
8.2.10.0120.01018.43
8.2.00.0170.00618.37
8.1.330.0110.00822.11
8.1.320.0070.00516.44
8.1.310.0080.00016.72
8.1.300.0180.00617.37
8.1.290.0200.00523.56
8.1.280.0210.00721.07
8.1.270.0220.00519.69
8.1.260.0130.00821.90
8.1.250.0120.01222.73
8.1.240.0130.00819.79
8.1.230.0160.00919.22
8.1.220.0160.00417.54
8.1.210.0150.00718.08
8.1.200.0070.00517.98
8.1.190.0070.00717.89
8.1.180.0120.00518.29
8.1.170.0150.00418.03
8.1.160.0150.00818.04
8.1.150.0160.00618.06
8.1.140.0100.01118.15
8.1.130.0130.00818.11
8.1.120.0180.00418.14
8.1.110.0140.00618.15
8.1.100.0160.00518.10
8.1.90.0180.00218.12
8.1.80.0120.00818.13
8.1.70.0140.00518.13
8.1.60.0140.00618.20
8.1.50.0170.00518.20
8.1.40.0150.00718.36
8.1.30.0200.00218.38
8.1.20.0180.00418.25
8.1.10.0190.00618.26
8.1.00.0160.00518.10
8.0.300.0100.01018.49
8.0.290.0130.00317.51
8.0.280.0190.00517.77
8.0.270.0140.00617.78
8.0.260.0170.00317.66
8.0.250.0180.00517.82
8.0.240.0190.00017.71
8.0.230.0090.00517.79
8.0.220.0160.00517.69
8.0.210.0050.00917.77
8.0.200.0160.00417.75
8.0.190.0190.00317.72
8.0.180.0170.00317.84
8.0.170.0160.00417.72
8.0.160.0140.00617.84
8.0.150.0150.00617.65
8.0.140.0170.00517.74
8.0.130.0170.00417.68
8.0.120.0150.00517.66
8.0.110.0160.00417.69
8.0.100.0180.00417.76
8.0.90.0160.00517.63
8.0.80.0160.00217.81
8.0.70.0120.00617.74
8.0.60.0180.00317.67
8.0.50.0170.00417.72
8.0.30.0120.00817.74
8.0.20.0190.00217.73
8.0.10.0100.01017.81

preferences:
59.58 ms | 403 KiB | 5 Q