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;
Output for git.master, git.master_jit, rfc.property-hooks
strlen ГРАЙ: 8 single-byte mask: �******� grapheme mask: Г**Й mb mask: Г**Й

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:
27.75 ms | 401 KiB | 8 Q