How to replace brackets and add minus sign to a number using PHP
<p>I have this variable-  <code>$number</code> which may contain different types of number format. </p>

<p>Type1: <code>$number=200,000.00 ;</code> Type2: <code>$number=(200,000.00) ;</code> Type3: <code>$number=(20.50) ;</code></p>

<p>If the number has brackets I want to remove the brackets and add a minus sign on its left side.</p>

<p>Example: If the number is <code>$number=(200,000.00) ;</code> I want to convert it to <code>-200,000.00</code> or in case of <code>$number=(20.50) ;</code> I want to convert it to <code>-20.50</code> but for <code>$number=200,000.00 ;</code> I want to keep it just the way it is. </p>

<p>I have tried this <code>preg_replace('/[()^\d-]+/', '', $number);</code>  but its not working. </p>

<p>Could you please show me how to get this done?</p>

<p>Thanks :)</p>
