Posted by Ryan Lange on 02/28/06 06:23
Smiley wrote:
> I thought that PHP automatically set the data type of a variable based on
> what kind of data was inside...
It changes data type based on the type of the data you assign to
the variable. In other words...
$var = 12.34; // float
$var = "12.34"; // string
Unless the data you receive from PayPal is serialized, PHP has
absolutely no idea what the data type of a specific value is; it's all
text (i.e. a string).
Still, I don't understand why you were having a problem with this.
I tested this out:
<?php
$var1 = 12.34;
$var2 = "12.34";
if( $var1 != $var2 ) {
echo "$var1 != $var2";
} else {
echo "$var1 == $var2";
}
?>
...and it echoed out "12.34 == 12.34".
- Ryan
[Back to original message]
|