What is the best way to extract a specific substring from a string in PHP?

To extract a specific substring from a string in PHP, you can use the `substr()` function. This function allows you to specify the starting position and length of the substring you want to extract from the original string. By providing the appropriate parameters to the `substr()` function, you can easily extract the desired substring.

// Example code to extract a specific substring from a string
$string = "Hello, World!";
$substring = substr($string, 7, 5); // Extracts "World"
echo $substring;