I am trying to separate numbers from a string like this: -4-25-30 with php
I have tried following things:
$fltr = array();
for($i=0;$i<count($q);$i++) {
$odr = $q[$i]['odr'];
$fltr = preg_match_all('/([a-z0-9_#-]{4,})/i', $odr, $matches);
}
this one gives an output: 1
and the explode function:
$fltr = array();
for($i=0;$i<count($q);$i++){
$odr = $q[$i]['odr'];
$fltr = explode($odr, '-');
}
note: $odr contains the string.
this one gives an O/P: "-"
I want to fetch all the numbers from the string.
explode('-', trim('-4-25-30', '-')).