Stooney Posted April 9, 2008 Share Posted April 9, 2008 I'm working on a script that will sort through a text file. I need to identify each line based on the first few characters. I need a Regular expression to let me know if a string starts with 'CLIENT ID'. So in short If ($string starts with 'CLIENT ID') do stuff else do something else Is there an easier way other than regex by chance? I'm not too familiar with it yet. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted April 9, 2008 Share Posted April 9, 2008 <?php if(substr($string,0,9) == 'CLIENT ID'){ //do stuff }else{ //do something else } ?> 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.