title: SimpleXMLElement (string) casting not working as expected
body: <p>Here is the print of a SimpleXMLElement:</p>
  
  <pre><code>SimpleXMLElement Object
  (
      [Amount] =&gt; 6.00
  )
  </code></pre>
  
  <p>This is what I am doing:</p>
  
  <pre><code>$amount = (string) $xml-&gt;Amount;
  echo $amount;
  </code></pre>
  
  <p>I can see <strong>6.00</strong> without any issue on screen but functions still see this value as 0 (false) even if I am using casting. I double-checked it as follows:</p>
  
  <pre><code>$amount = $xml-&gt;Amount;
  var_dump($amount);
  // Returns » object(SimpleXMLElement)#189 (1) { [0]=&gt; string(4) "6.00" }  
  
  $amount = (string)$xml-&gt;Amount;
  var_dump($amount);
  // Returns » string(4) "6.00"
  
  $amount = (string)$xml-&gt;Amount[0];
  var_dump($amount);
  // Returns » string(4) "6.00" 
  </code></pre>
  
  <p>It should work but it doesn't and I don't know why. Immediately after the casting, I'm using $amount to calculate a percentage value but I always end with $amount and $percentage equal to 0 (zero).</p>
  
  <p>Edit. Here is the requested part of code:</p>
  
  <pre><code>$amount = (string) $xml-&gt;Amount;
  $amount = $amount / $rate;
  $amount = number_format($amount, 2);
  
  $percentage = ($amount * (1 / 100)) + 0.10;         
  $percentage = $percentage / $rate;
  $percentage = number_format($percentage, 2);
  </code></pre>
  
  <p>p.s. $rate is another variable that is 100% fine, correct and that always exists. It doesn't come from SimpleXMLElement.</p>