Page 1 of 1

Remove First Character In A String

Posted: Mon Apr 25, 2005 9:12 pm
by jwalsh
Hi,

I have code that returns the following string..

:3:5:2:5

and I need to trim off the first : so it says

3:5:2:5

is there an easy way to do this?

Thanks,

Josh

Posted: Mon Apr 25, 2005 9:15 pm
by jwalsh
Got it working this way...


Code: Select all

$string = &quote;:3:4:6:3:5&quote;;
$length = (strlen($string) - 1);
echo substr_replace($string, '', 0, '-' .$length);
Is this best?

Posted: Mon Apr 25, 2005 9:32 pm
by John Cartwright
close

Code: Select all

$string = ":3:4:6:3:5";
echo substr($string, 1);    // 3:4:6:3:5