In PHP, is there a way to stop it evaluating two strings "1" and "1.0" as the same? The code below illustrates what I'm talking about:
<?php
$str1 = "1";
$str2 = "1.0";
if($str1==$str2){
echo "equal";
}else{
echo "not equal";
}
?>
The problem for me is that I'm trying to check whether a user has changed a value when they submit it back to the server. At the moment if a user changes the value from "1" to "1.0" it should pick up the fact that they've changed the record and allow them to save it to the database - however because PHP evaluates them both as numbers when comparing them it thinks the user has made no changes and doesn't allow them to save it.
Is there any way around this?