I need some help understanding the trim function. From the docs, its says the following about character_mask:
character_mask Optionally, the stripped characters can also be specified using the character_mask parameter. Simply list all characters that you want to be stripped. With .. you can specify a range of characters.
When I test by specifying trim($num,"$\,")
, its not working as I expected.
$num = '$1,000.00';
$findSymbol = strpos($num, '$'); // find $ symbol
if ($findSymbol === false) {
$num = $num;
}else{
$num = trim($num,"$\,"); // strip the $ and the , symbol
}
var_dump($num); //OUTPUT: 1,000.00
Basically, all I want is strip the $
and the ,
symbols all together so the output would look like this:
1000.00
Any help is greatly appreciated. Thanks!