CMNetworx Posted February 11, 2008 Share Posted February 11, 2008 Hello, I think this will probably be simple to someone that knows more php than myself.. I have a number, ex 354684651 I would like to strip off the first 2 characters, What would be the best way to go about this? Quote Link to comment https://forums.phpfreaks.com/topic/90429-strip-first-2-characters/ Share on other sites More sharing options...
trq Posted February 11, 2008 Share Posted February 11, 2008 If it truely is a number then... <?php $n = 354684651; echo $n - 350000000; ?> otherwise.... <?php echo substr('354684651',1); ?> Quote Link to comment https://forums.phpfreaks.com/topic/90429-strip-first-2-characters/#findComment-463600 Share on other sites More sharing options...
CMNetworx Posted February 11, 2008 Author Share Posted February 11, 2008 It is a number, and the first 2 digits are almost always the same, but I think I will use the substr, just to make sure I don't encounter a math mistake if I tell it to subtract the wrong number.. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/90429-strip-first-2-characters/#findComment-463610 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.