获取警告“已弃用:函数ereg()已弃用”[重复]

This question already has an answer here:

I am getting this warning:

Deprecated: Function ereg() is deprecated in

PHP Code:

if ($kill_bullets == 0 || !$kill_bullets || ereg('[^0-9]',$kill_bullets)){
    echo "Invalid Bullets!";
} elseif ($kill_bullets != 0 || $kill_bullets || !ereg('[^0-9]',$kill_bullets)) {
}
</div>

The POSIX compatible regexps are deprecated. You should use the PCRE instead.

preg_match would be the equivalent to ereg with a little bit different syntax.

if (!$kill_bullets || !ctype_digit($kill_bullets)) {
    echo "Invalid Bullets!";
}

When i click sumbit button nothing happens?

Try this snippet.

if (!$kill_bullets || !ctype_digit($kill_bullets)) {
    echo "Invalid Bullets!";
} else {
    echo "Valid Bullets. okay.";
}