Tribe__Tickets__Commerce__Currency::get_symbol_codes( string $symbol )
Returns the currency 3-letter codes for a symbol.
Contents
Parameters
- $symbol
-
(string) (Required) A currency symbol in escaped or unescaped form.
Return
(array|string) All the currency codes matching a currency symbol.
Source
File: src/Tribe/Commerce/Currency.php
public function get_symbol_codes( $symbol ) {
// if its already a 3-letter code return it immediately
if ( array_key_exists( strtoupper( $symbol ), $this->currency_code_options_map ) ) {
return strtoupper( $symbol );
}
$matches = array();
foreach ( $this->currency_code_options_map as $currency_code => $currency ) {
if ( $currency['symbol'] === $symbol || html_entity_decode( $currency['symbol'] ) === $symbol ) {
$matches[] = $currency_code;
}
}
return count( $matches ) > 0 ? $matches : array();
}
Changelog
| Version | Description |
|---|---|
| 4.8 | Introduced. |