xionhack Posted April 17, 2009 Share Posted April 17, 2009 Hello. I want to make a function that will store a string in a variable. If there is a dash (-) in the string, it will set the variable to NULL, if it has no dashes then it will store that string in the variable. How can i do that? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/154534-find-in-a-word/ Share on other sites More sharing options...
premiso Posted April 17, 2009 Share Posted April 17, 2009 strstr $string = "test-dash"; if (strstr($string, "-") !== false) { $string = null; } Quote Link to comment https://forums.phpfreaks.com/topic/154534-find-in-a-word/#findComment-812538 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.