Reply to Re: if statement weirdness

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация