fork download
  1. <?php
  2.  
  3. // Третья строка из вашего массива
  4. $subject = 'Договор на оказание услуг: 654.30 руб.';
  5.  
  6. if (preg_match_all('/\d+(?:\.\d+)?(?= руб\.)/', $subject, $result)) {
  7. list($price1, $price2) = $result[0];
  8. }
  9.  
  10. var_dump($price1, $price2);
Success #stdin #stdout #stderr 0.02s 24432KB
stdin
Standard input is empty
stdout
string(6) "654.30"
NULL
stderr
PHP Notice:  Undefined offset: 1 in /home/RDqYGK/prog.php on line 7