I have this variable- $number
which may contain different types of number format.
Type1: $number=200,000.00 ;
Type2: $number=(200,000.00) ;
Type3: $number=(20.50) ;
If the number has brackets I want to remove the brackets and add a minus sign on its left side.
Example: If the number is $number=(200,000.00) ;
I want to convert it to -200,000.00
or in case of $number=(20.50) ;
I want to convert it to -20.50
but for $number=200,000.00 ;
I want to keep it just the way it is.
I have tried this preg_replace('/[()^\d-]+/', '', $number);
but its not working.
Could you please show me how to get this done?
Thanks :)