In PHP, what are the equivalent methods to scanf in C and cin in C++ for receiving user input?

In PHP, the equivalent methods to scanf in C and cin in C++ for receiving user input are the fgets() and readline() functions. fgets() reads a line from a file pointer, while readline() reads a line from the standard input. These functions can be used to receive user input in PHP programs.

// Using fgets() to receive user input
echo "Enter your name: ";
$name = fgets(STDIN);

// Using readline() to receive user input
echo "Enter your age: ";
$age = readline();