Reputation: 5471
I would like to strip everything in a string before a - and leave what's after that. For example:
15.11-101
I want to strip 15.11 and leave 101. I've tried a few different things, but can't seem to get it working, if anyone could help me out, that'd be fantastic :)
Cheers
Leanne
Upvotes: 0
Views: 144
Reputation: 53606
assuming it appears only once, you can use the explode function.
$s='15.11-101';
$a=explode('-',$s,1);
echo $a[1];
This should be the fastest way.
Upvotes: 3
Reputation: 2115
You could use something like this:
$result = substr($original, strpos($original, '-') + 1);
Upvotes: 6