title: remove dollar sign from string
body: <p>This one got me puzzled</p>
  
  <p>Trying to remove a dollar sign from a string proved to be impossible,
  whats wrong here ?</p>
  
  <p>Here is what i have to work with:</p>
  
  <pre><code>array(2) { [0]=&gt; string(10) "$18.95" [1]=&gt; string(11) " $17.06" }
  </code></pre>
  
  <p>this is what i have tried</p>
  
  <ol>
  <li><code>floatval($price[0]);</code></li>
  <li><code>str_replace('$','',$price[0]);</code></li>
  <li><code>ltrim($price[0],'$');</code></li>
  <li><code>floatval(ltrim($price[0],'$'));</code></li>
  <li><code>floatval(preg_replace("/^[^0-9\.]/","",$price[0]))</code></li>
  </ol>
  
  <p>the only close one was </p>
  
  <pre><code>floatval(preg_replace('/[^\d\.]/', '', $price[0]))
  </code></pre>
  
  <p>but it added "36" to the number - insteadh of 18.95 i got 3618.95</p>
  
  <p>nothing is working ... why ?</p>
  
  <p>`</p>