mike1313 Posted November 30, 2007 Share Posted November 30, 2007 is there anyway to check if the beginning of whatever the user inputs is a space like. Instead of "Hello World" they input " Hello World" I need a way of checking if the space is there first and I'm not talking about trim(); Quote Link to comment Share on other sites More sharing options...
eon201 Posted November 30, 2007 Share Posted November 30, 2007 $findme = ' Hello World'; //notice the white space $hellofinder = stripos($your_string, $findme); if ($hellofinder === false){ echo "Im not here!"; } else{ echo "Im here!"; } You could then use the str_replace function to change ' Hello World' to 'Hello World' if needed. Hope that helps. 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.