latino.ad7 Posted February 26, 2010 Share Posted February 26, 2010 If I want my variable to begin with abc, how do I code that? In SQL you add % sign at the end, but how to do it in PHP? $var[0] = 'abcdef'; $var[1] = 'xyzxyz'; if ($var[$value] == 'abc%') { echo 'ok'; } else { echo 'not ok'; } Quote Link to comment Share on other sites More sharing options...
alpine Posted February 26, 2010 Share Posted February 26, 2010 <?php $data = "ABCDEF"; if(substr($data,0,3) == "ABC") ?> Quote Link to comment Share on other sites More sharing options...
latino.ad7 Posted February 26, 2010 Author Share Posted February 26, 2010 Yes, thats it. Thanks. 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.