fork download
  1. <?php
  2.  
  3. $var = '(1) - (2) - (3)';
  4.  
  5. preg_match_all('#\((\d+)\)#', $var, $output);
  6.  
  7. $resultado = $output[1];//Pega apenas os nĂºmeros
  8.  
  9. print_r($resultado);
Success #stdin #stdout 0.04s 52480KB
stdin
Standard input is empty
stdout
Array
(
    [0] => 1
    [1] => 2
    [2] => 3
)