i have this string :
"5d2e1fe"
and i want to get only : "521"
how can i do it?
thanks in advance
peleg
how can i clean chrs that are not numbers and live only numb
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
You could use [php_man]preg_replace[/php_man]():
Mac
Code: Select all
$text_and_numbers = '5d2e1fe';
$just_numbers = preg_replace('/[^0-9]/', '', $text_and_numbers);
echo $just_numbers;- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK