What alternative methods can be used to extract a specific portion of a string in PHP?

When you need to extract a specific portion of a string in PHP, you can use functions like `substr()` or `explode()` depending on the structure of the string. `substr()` allows you to extract a portion of a string based on the start position and length, while `explode()` can be used to split a string into an array based on a delimiter.

// Using substr() to extract a specific portion of a string
$string = "Hello, World!";
$substring = substr($string, 0, 5); // Extracts "Hello"

// Using explode() to extract a specific portion of a string
$string = "apple,banana,orange";
$fruits = explode(",", $string); // Splits the string into an array based on ","
echo $fruits[1]; // Outputs "banana"