What is the function in PHP used to select only a few characters from a string?

To select only a few characters from a string in PHP, you can use the `substr()` function. This function takes three parameters: the input string, the starting position of the substring, and the length of the substring. By specifying the starting position and length, you can extract a portion of the original string.

$inputString = "Hello, World!";
$substring = substr($inputString, 7, 5);
echo $substring; // Output: World