fork download
  1. <?php
  2.  
  3. $re = "/[\\d.]+/";
  4. $str = "100.25$-500$";
  5.  
  6. preg_match_all($re, $str, $matches);
  7.  
  8. var_dump($matches);
  9.  
  10. echo ($matches[0][1] * 10) . "$-" . ($matches[0][1] * 2) . "$";
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
array(1) {
  [0]=>
  array(2) {
    [0]=>
    string(6) "100.25"
    [1]=>
    string(3) "500"
  }
}
5000$-1000$