Albert,
I'm a little confused as to what you're looking for.
When you say "extract numbers...", do you mean you want to use the
numbers and throw away the rest (the common meaning of extract), or do
you want to throw away the numbers and save the rest?
For instance, if you have:
xx/yy/178 1771 80 279
The common meaning of "extract numbers..." would give you
178 1771 80 279
possibly as four elements of an array (I'm not sure if you want four
elements or all four numbers in one element).
But from your comments, I think you want
xx/yy/
The question here would be - is it always two substrings separated by a
'/' and ending with a '/'?
If the latter, I think the easiest way would be to find the location of
the second '/' with two calls to strpos, i.e.
function findval($str) {
$pos = strpos($str, '/'); // Find first '/'
if ($pos === false)
return false; // Or you could return $str
$pos = strpos($str, '/', $pos+1);
if ($pos === false)
return false; // Or you could return $str
return substr($str, 0, $pos-1);
}
If you're looking for something else, please clarify.
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstu...@attglobal.net
==================