This code: <? $var1 = "020610000030012452"; $var2 = "020610000030012451"; $test1 = (string) $var1 $test2 = (string) $var2; echo gettype($test2)."---".gettype($test1)."<BR><BR>"; echo $test2."---".$test1."<BR><BR>"; if ( $test2 != $test1){ echo ("The variables are not equal."); } ?> Produces the following output (Notice that it doesn't say vars are not equal); -------------------------------------------------------------------- string---string
020610000030012451---020610000030012452 -------------------------------------------------------------------- And this code: <? $var1 = "A"."020610000030012452"; $var2 = "A"."020610000030012451"; $test1 = (string) $var1 $test2 = (string) $var2; echo gettype($test2)."---".gettype($test1)."<BR><BR>"; echo $test2."---".$test1."<BR><BR>"; if ( $test2 != $test1){ echo ("The variables are not equal."); } ?> Produces the following output (Notice it printed the message about vars not being equal); -------------------------------------------------------------------- string---string 020610000030012451---020610000030012452 The variables are not equal. -------------------------------------------------------------------- Why does PHP Version 4.2.3 ignore my (string) - cast to string in the if evaluation? I even tried putting the (string) inside the IF statement with no difference in execution. P.S. The variables were reporting string before I even tried (string). James E Hicks III -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php