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', function ($m) use ($minFill) { return $m[1] . str_repeat("*", max($minFill, mb_strlen($m[2], 'UTF-8'))) . ($m[3] ?: $m[1]); }, $emails ); var_export(array_combine($emails, $mask));
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'a@example.com' => 'a****a@example.com', 'ab@example.com' => 'a****b@example.com', 'abc@example.com' => 'a****c@example.com', 'abcd@example.com' => 'a****d@example.com', 'abcde@example.com' => 'a****e@example.com', 'abcdef@example.com' => 'a****f@example.com', 'abcdefg@example.com' => 'a*****g@example.com', 'Ф@example.com' => 'Ф****Ф@example.com', 'ФѰ@example.com' => 'Ф****Ѱ@example.com', 'ФѰД@example.com' => 'Ф****Д@example.com', 'ФѰДӐӘӔӺ@example.com' => 'Ф*****Ӻ@example.com', '"a@tricky@one"@example.com' => '"************"@example.com', )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
36.37 ms | 407 KiB | 5 Q