<?php function asterisk($password) { $count = min(strlen($password), 4); $passwordAsterisk = str_repeat('*', $count) . substr($password, $count); echo $password . ' => ' . $passwordAsterisk . PHP_EOL; return $passwordAsterisk; } asterisk('abcdef'); asterisk('abc'); asterisk('');
You have javascript disabled. You will not be able to edit any code.