How can PHP be used to separate a string into two strings, such as extracting area codes from phone numbers?
To separate a string into two strings, such as extracting area codes from phone numbers in PHP, you can use the `substr()` function to extract the desired portion of the string. In the case of extracting area codes from phone numbers, you can use `substr($phoneNumber, 1, 3)` to extract the first three characters of the phone number, which typically represent the area code.
$phoneNumber = "123-456-7890";
$areaCode = substr($phoneNumber, 0, 3);
echo "Area Code: " . $areaCode . "\n";
$remainingNumber = substr($phoneNumber, 4);
echo "Remaining Number: " . $remainingNumber;