PHP doesn't read from keyboard. It really can't since it's a server side language. The only user inputs PHP can get are sent viat HTTP requests POST or GET. There is no true "keyboard input".
Using the function sscanf you can basically format an already received string according to some rule. However, this is often redundant since firstly PHP is not strongly type and variable types are commutable, secondly: to parse a string as a specific data type, each type has dedicated functions which have much better results and thirdly, it is a rare case where forcing a format in a string (forcing as in forcefully formatting the string instead of actually checking for proper format) instead of checking the format is truly useful in a web application (this is because PHP never communicates directly with the user, unlike other languages).