pelegk1
12-16-2003, 03:47 AM
i have this string :
"5d2e1fe"
and i want to get only : "521"
how can i do it?
thanks in advance
peleg
"5d2e1fe"
and i want to get only : "521"
how can i do it?
thanks in advance
peleg
|
Click to See Complete Forum and Search --> : how can i clean chrs that are not numbers and live only number pelegk1 12-16-2003, 03:47 AM i have this string : "5d2e1fe" and i want to get only : "521" how can i do it? thanks in advance peleg YoN 12-16-2003, 09:58 AM Try this: <?php $variablee = "125sdf6fsg74d5f4ghADFH5dfh"; $result = preg_replace("/[^1-9]/", "", $variablee); echo $result; ?> HTH pyro 12-16-2003, 10:00 AM You might want to simplify and use: $result = preg_replace("/\\D/", "", $variablee); YoN 12-16-2003, 10:12 AM Ohh! nice to know that :D Thanks Pyro pyro 12-16-2003, 10:16 AM No problem... :p pelegk1 12-17-2003, 12:48 AM the result to contain all number and a dot (.) ? pyro 12-17-2003, 07:04 AM $result = preg_replace("/[^\.\d]/", "", $variablee); webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |