3v4l.org

run code in 300+ PHP versions simultaneously
<?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"; }

preferences:
63.12 ms | 404 KiB | 5 Q