What are some alternative approaches to extracting currency symbols from a string in PHP, besides using regular expressions?

When extracting currency symbols from a string in PHP, an alternative approach to using regular expressions is to use the `str_replace` function to replace any non-currency symbol characters with an empty string. This method allows you to specifically target and remove unwanted characters from the string without the complexity of regular expressions.

$string = "The price is $100";
$currency_symbols = array('$', '€', '£', '¥'); // List of currency symbols to extract

// Remove non-currency symbol characters from the string
$cleaned_string = str_replace(str_split(preg_replace('/[^\p{L}\p{N}\s]/u', '', $string)), '', $string);

// Extract currency symbols from the cleaned string
$extracted_symbols = str_replace(str_split(preg_replace('/['.implode('', $currency_symbols).']/', '', $cleaned_string)), '', $cleaned_string);

print_r($extracted_symbols); // Output: $