shmideo Posted November 29, 2014 Share Posted November 29, 2014 Hi Using: echo $row['columnname']; How can I strip off data from the above echo? The column always begins with 'Local/' then 3 digits then other unwanted data, lke 'Local/567@context-0000461d;1'. It would be ideal to just display '567'. Quote Link to comment Share on other sites More sharing options...
Barand Posted November 29, 2014 Share Posted November 29, 2014 echo substr('Local/567@context-0000461d;1', 6, 3); //--> 567 Quote Link to comment Share on other sites More sharing options...
shmideo Posted November 29, 2014 Author Share Posted November 29, 2014 (edited) Thanks Barand, I should have mentioned that the 3 digits will always change but after that it will also change. Sorry I should have been clearer. Edited November 29, 2014 by shmideo Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted November 29, 2014 Share Posted November 29, 2014 should have mentioned that the 3 digits will always change but after that it will also change. Barands code returns the 3 digits after local/ Are you now saying their could be more than 3 digits after Local/? Quote Link to comment Share on other sites More sharing options...
shmideo Posted November 29, 2014 Author Share Posted November 29, 2014 I managed to get it working. echo substr($row['columnname'], 6, 3); This just displays those 3 digits. Local/ is always there, the rest changes, so just wanted the 3 digits to show. Sorry for the confusion Quote Link to comment 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.