if (preg_match("/[A-Z]+$/", $id)) {
would return true for any string ending in at least one of the letters A-Z.
To look for a specific thing, you could do, say,
if (strlen($id) > 2 && substr($id, -2) == "XD") {
1
solved If statement for variable ending in certain letters [closed]