<?php
$names = array('joe123456',
'joe123',
'1joe1234',
'123joe456');
foreach ($names as $name) {
$new_name = preg_replace('/\d/', '', $name);
if (strlen($new_name) <= strlen($name) - 6) {
$name = $new_name;
}
echo "$name\n";
}
- Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.14, 8.4.1
- joe
joe123
1joe1234
joe
preferences:
60.39 ms | 407 KiB | 5 Q