finding and storing values from string
i have a string which looks something like this:

    $fetched = name=myName zip=420424 country=myCountry; 
    // and so on, it is not an array 

I fetch these values from an api.

I want only the zip=873289 (infact only the numbers).

So i use:

    // $fetched above is the output of the fuction below
    $fetched = file_get_contents("http://example.com");

this way i fetch the contents and can match it with this code

    $zip = preg_match ('/zip=[0-9]+/', $fetched );

but i want to store it in the variable, what is function to store the matched results?


Thank You.



finding and storing values from string
===

i have a string which looks something like this:

    $fetched = name=myName zip=420424 country=myCountry; 
    // and so on, it is not an array 

I fetch these values from an api.

I want only the zip=873289 (infact only the numbers).

So i use:

    // $fetched above is the output of the fuction below
    $fetched = file_get_contents("http://example.com");

this way i fetch the contents and can match it with this code

    $zip = preg_match ('/zip=[0-9]+/', $fetched );

but i want to store it in the variable, what is function to store the matched results?


Thank You.


