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! 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; } Link to comment https://forums.phpfreaks.com/topic/154534-find-in-a-word/#findComment-812538 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.