What is the PHP function used to extract a portion of a string?

To extract a portion of a string in PHP, you can use the `substr()` function. This function takes three parameters: the string you want to extract from, the starting position of the extraction, and optionally the length of the extracted substring. Example:

$string = "Hello, World!";
$extracted = substr($string, 7, 5); // Extracts "World" starting from position 7
echo $extracted; // Output: World