Would anyone mind helping me understand how to assign a variable from an 
matching string search?
 
I will give some background as to what I am doing.  I work with tires all day 
long and I am trying to use a dynamic way in which people can give me tires 
sizes  and I can give them answers based upon that dynamic input.
 
For example..
 
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);
print_r($ptiresize[0]);
 
1) If I don't specify the "[0]" in the print_r command I get the following 
answer below, and I don't know enough to understand why and thats ok because I 
have no shame is saying I have no idea what I am doing, other than trying to 
learn:
 
Array
(
    [0] => Array
        (
            [0] => 245
            [1] => 45
            [2] => 17
        )
    [digit] => Array
        (
            [0] => 245
            [1] => 45
            [2] => 17
        )
    [1] => Array
        (
            [0] => 245
            [1] => 45
            [2] => 17
        )
)
 
However if I do specify the [0] I get just the 3 lines which is the 1st part to 
what I want.  The 2nd part of what I want to accomplish is having a tire size 
that is one single number.  ie. 2454517.
 
Can anyone tell me how I can accomplish the filtering of data to get my 
preferred format of a single number and then assigned that single # to a 
variable.
 
For example:
 
$newsize = Array($tiresizearray[0].$tiresizearray[1].$tiresizearray[3])
 
I know the above line is wrong but hopefully someone understands what I am 
trying to do.  Any and all help is appreciated.
 
Sincerely,
 
Neal Slensker

[Non-text portions of this message have been removed]

Reply via email to