- var_dump: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$text = '9 - 1';
preg_match_all('/\d+/', $text, $out, PREG_SET_ORDER);
var_dump($out);
$text = '5-3';
preg_match_all('/\d+/', $text, $out, PREG_SET_ORDER);
var_dump($out);