Ereg and eregi equivalent

From what I understand ereg and eregi has been depreciated. I have searched all over google but I cant find an equivalent command for it in PHP. Basically I am trying to make sure that a string only contains numbers and letters then from there I have to make an anti SQL injection function.