Comparing Strings

From: Date: Mon, 24 Jul 2006 15:21:59 +0000
Subject: Comparing Strings
Groups: php.general 
Request: Send a blank email to php-general+get-239731@lists.php.net to get a copy of this message
Hi folks, well, I have a really dumb question: I have the following script at http://www.tisys.org/misc/test.php: <?php echo $_GET['license']; ?> Now I call it like this: http://www.tisys.org/misc/test.php?license=070177016081137173166041245224242038105254210007183127207103162117160180165221170166096217228128 And in fact, it echos the whole, long GET-string! Now i have the following script a tttp://www.tisys.org/misc/ol_license.php: <?php if ($_GET['license'] == "070177016081137173166041245224242038105254210007183127207103162117160180165221170166096217228128") {
    echo '1';
} else {
    echo '0';
} ?> I launch it like: http://www.tisys.org/misc/ol_license.php?license=070177016081137173166041245224242038105254210007183127207103162117160180165221170166096217228128 And it returns a 1, which means: The strings match. Now I call it like http://www.tisys.org/misc/ol_license.php?license=170177016081137173166041245224242038105254210007183127207103162117160180165221170166096217228128 that is, I have changed the first number of my GET-String from a 0 to a 1 and indeed, the script returns 0, meaning: The scripts don't match. *HOWEVER*, no I call the script like: http://www.tisys.org/misc/test.php?license=070177016081137173166041245224242038105254210007183127207103162117160180165221170166096217228129 that is, I have changed the last number of the GET-String from an 8 to a 9, and interestingly, it returns 1 this time, which means the strings do match, which, however, they don't. My guess is that PHP only sees / compares the strings up to a certain position. Is this possible? And if so, is there any way around this, so that my whole string is seen? Greetings and thanks in advance, Nils

« previous php.general (#239731) next »