cgm225 Posted August 24, 2008 Share Posted August 24, 2008 I want to do a if/else conditional statement based on whether a variable contains a string starting with "http://" ... could someone help me do this? Thanks again! Link to comment https://forums.phpfreaks.com/topic/121149-if-variable-contains-a-string-starting-with-http/ Share on other sites More sharing options...
genericnumber1 Posted August 24, 2008 Share Posted August 24, 2008 this should be a little more efficient than regex.. <?php if(substr($str, 0, 7) == 'http://') { echo $str . ' starts with http://'; } ?> Link to comment https://forums.phpfreaks.com/topic/121149-if-variable-contains-a-string-starting-with-http/#findComment-624530 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.