PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I wonder if anyone can see what might be happening here. I have a string that returns a value 40.00 . This I know (from my cart) is outputted as a ‘string’ value and not an integer. When I convert it to and integer value is returns a ‘0’ value and I cannot see why.
<?PHP $dollarTotal =(getPriceList); ?>
<?PHP settype($dollarTotal, "int") ; ?> // changes it to an int
<?PHP echo gettype($dollarTotal); ?> // proves its an int
<?PHP echo $dollarTotal ; ?> returns a blank value
So what it missing from the maths? I have tried using trim just in case there is white space but this also is not the problem.
Thanks for any help
On line 2 - output the value of $dollarTotal to make sure it's what you think it is.
<?PHP echo $dollarTotal ; ?> // gives 40.00
Yeah thanks I have and it returns 40.00 which is what I'm expecting. I wish I could test the string to see if there are hidden elements (such as HTML maybe) that are not visable. I have tried var_dump and nothing is giving me a clue.
Very strange
<span id="divPrice3"> 40.00 </span> is what’s in the source view so I needed to simply use strip tags and this sorted it out. Ahh 24hours lost but I guess a lot learned!
Thanks to all for the help!