What are some common methods for extracting specific data from a string in PHP?

When working with strings in PHP, there are several common methods for extracting specific data. One of the most popular methods is to use regular expressions to match and extract the desired data from the string. Another approach is to use built-in string functions such as `strpos`, `substr`, `explode`, or `preg_match` to extract specific parts of the string based on certain criteria.

// Example: Extracting email address from a string using regular expressions
$string = "Contact us at email@example.com for more information.";
$pattern = '/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/';
preg_match($pattern, $string, $matches);
$email = $matches[0];
echo $email;