> If I have vendors that give me tire sizes in the following different
formats:
>
> 215 45 17
> 215/45/R17
> 215/45ZR17
> 2154517
>
> I really prefer the tire sizes to be formated as a single number ie:
2454517
>
> What I have done so far is:
>
> $string = '245/45ZR17';
> $tiresizearray = preg_match_all( '/(?<digit>\d+)/', $string, $ptiresize);
When you are having a hard time: try to do the other way round.
When you read the following line you'll surely slap yourself with an old
fish. ;)
$string=preg_replace("/[^0-9]+/","",$string);
It says: "Replace every char that is not a digit with nothing"
HTH,
Patrick
--
PS.
Yeah Bob, I still remember you. ;) Because my job forces me to go for
complex javascript/ajax, html, xml and java programming I lost a bit
track of PHP - but I'm still receiving and reading it. I thougth: why
not answering some php stuff as long as I do remember what PHP is. ;)