Im so so new to php and sry for my begginer question .

        $Sal = "HI";
        if (preg_match("[a-zA-Z][a-zA-Z]",$Sal)) echo "hi";


this is my code , why doesent the preg_match run and echo "hi"? thank you

NO , Nothing just an empty page and know its like this with yours but no answer

<!DOCTYPE html>

        <p>  </p>

        $Sal = "HI";
        if (preg_match("/[^a-zA-Z ]/",$Sal)) echo "hi";


ok, now I tested this and it worked

if (preg_match("/[^a-zA-Z ]/",$Sal)==0) echo "hi";

No not still

(preg_match("/[^A-Z ]/",$Sal)==0) Now everything echos like If I change $sal to hh it will echo but if you mention it should have a uppercase that it doesent have

Member Avatar


Try this:

$Sal = "HI";

if (preg_match ('/[a-zA-Z][a-zA-Z]$/',$Sal)) {

echo "\nhi\n";