can someone help me to solve the code of my php.
please help me..
PHP can’t read string converted into integer, the result is always 0
here is the code
[code]
<html>
<body>
<div id=’div1′></div>
<div id=’div2′>
<H2>demo string to integer </H2>
<p> the example of value is <span style=”font-style: italic;”>12</span> </p>
<?php $shtm=”<div id=’a’>12</div>” ;?>
</div>
</body>
</html>
<?php
$doc = new DOMDocument();
$doc->loadHTML($shtm);
$div = $doc->getElementById(“a”);
$nval= $div->ownerDocument->saveHTML($div);
echo ‘1. result before converted :’. $nval .'</br>’;
echo ‘2. using gettype : ‘. gettype($nval) .'</br>’;
echo ‘3. convert to integer using (int) :’ . (int)$nval.'</br>’;
echo ‘4. try using intval function :’ .intval($nval) .'</br>’; // it should be 13 but the result is the same
echo ‘5. try adding with 1 : ‘.(int)$nval+1 ;// it should be 13 but the result is error A non well formed numeric value encountered
?>
**(Added `[code]