tags:

views:

70

answers:

2

Hi all,

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

+3  A: 

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.

Itay Moav
+6  A: 

You could use something like this:

$result = substr($original, strpos($original, '-') + 1);
Christian Hang