Pull Values From PHP Array?

Obsidian Age

New member
Hi there, I have created an array that correctly displays the values I require, yet I cannot work out how to extract them.

(I changed $url in case data integrity is an issue)

$url PRODUCES = text 15.50% text 53 text 342 text 608 text 205 text 3095;
$string = file_get_contents($url);
$regex = '/[-+]?[0-9]*\.?[0-9]+/';
preg_match_all($regex, $string, $matches, PREG_SET_ORDER);
print_r($matches);

This prints:

Array ( [0] => Array ( [0] => 15.50 ) [1] => Array ( [0] => 53 ) [2] => Array ( [0] => 342 ) [3] => Array ( [0] => 608 ) [4] => Array ( [0] => 205 ) [5] => Array ( [0] => 3095 ) )

I need to extract these values, and store them as PHP variables as such:

$variable0 = 15.50
$variable1 = 53
$variable2 = 342

If someone could fix my script for me it would be greatly appreciated!

Cheers,
Obsidian Age
 
Back
Top