I would like to check if a string is in another string with comma separated. I've write some code and it work like this...
$find_number = '3'
$string_to_search = '1,3,124,12'
preg_match('/[^0-9]'.$find_number.'[^0-9]/', string_to_search);
//match
$find_number = '4'
$string_to_search = '1,3,124,12'
preg_match('/[^0-9]'.$find_number.'[^0-9]/', string_to_search);
//not match
Which is what I expected. The problem is that the first and last string can't recognized in this expression. What did I do wrong?