title: In Php, how to get float value from a mixed string?
body: <p>I got a string like:</p>
  
  <pre><code>$str = "CASH55.35inMyPocket";
  </code></pre>
  
  <p>I want to get <strong>55.35</strong> only.</p>
  
  <p>I tried:</p>
  
  <pre><code>$str = floatval("CASH55.35inMyPocket");
  if ($str &gt; 0) {
      echo "Greater_Zero";
  } else {
      echo "LessZERO!!";
  }
  // echo "LessZERO!!";
  </code></pre>
  
  <p>I also tried:</p>
  
  <pre><code>$str = (float)"CASH55.35inMyPocket";
  if ($str &gt; 0) {
      echo "Greater_Zero";
  } else {
      echo "LessZERO!!";
  }
  // echo "LessZERO!!";
  </code></pre>
  
  <p>According to the Documentation:</p>
  
  <blockquote>
    <p>Strings will most likely return <code>0</code> although this depends on the
    leftmost characters of the string.</p>
  </blockquote>
  
  <p>So, <code>flotval</code> and <code>(float)</code> apparently only work if the string is something like:
  <code>55.35aAbBcCdDeEfF</code>... but will NOT work if it is like: <code>aAbBcC55.35dDeEfF</code> </p>
  
  <p>is there a way to get the float <strong><em>no matter the position of text?</em></strong></p>