Assuming that you are willing to have this from several similar $str, and if you have them as an array, you can use the following code block to get them all as array output --
foreach($strings as $string){
$arr = explode('-',$string);
$result[$string]['val1'] = $arr[1];
$result[$string]['val2'] = $arr[2];
}
print_r($result);
This will give you an output like
Array
(
[price-100-500] => Array
(
[val1] => 100
[val2] => 500
)
[price-200-600] => Array
(
[val1] => 200
[val2] => 600
)
)
For better and exact answer you should provide better explanation of your problem. Hope for the best.
Thanks...:)