ukferret Posted April 17, 2007 Share Posted April 17, 2007 I am looking to delete the first 240 charcters from a string, anyone have any ideas how I would do this? and would I include white spaces or not? Quote Link to comment https://forums.phpfreaks.com/topic/47326-solved-chopping-characters-from-a-string-help/ Share on other sites More sharing options...
pro_se Posted April 17, 2007 Share Posted April 17, 2007 <?php $string = "String Here... " echo substr($string, 240); ?> Try that out and tell me if it works.. Quote Link to comment https://forums.phpfreaks.com/topic/47326-solved-chopping-characters-from-a-string-help/#findComment-230859 Share on other sites More sharing options...
ukferret Posted April 17, 2007 Author Share Posted April 17, 2007 This is the code in my script and it deos not remove the forst or last 2092 characters! got any ideas? <?php substr($file, 2092); echo $file; ?> Quote Link to comment https://forums.phpfreaks.com/topic/47326-solved-chopping-characters-from-a-string-help/#findComment-230863 Share on other sites More sharing options...
pro_se Posted April 17, 2007 Share Posted April 17, 2007 well, <?php $file = "something.txt" echo substr($file, 2092); ?> Quote Link to comment https://forums.phpfreaks.com/topic/47326-solved-chopping-characters-from-a-string-help/#findComment-230866 Share on other sites More sharing options...
ukferret Posted April 17, 2007 Author Share Posted April 17, 2007 I got around it by doing as you first suggested and echo'ing off that line instead of doing it seperatly and it works great cheers, oh and you do have to include white spaces echo substr($file, 2333); Many thanks. Quote Link to comment https://forums.phpfreaks.com/topic/47326-solved-chopping-characters-from-a-string-help/#findComment-230867 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.