comparing strings
Posted: Mon Nov 25, 2002 8:53 am
I know that the == operator should not be used to compare strings.
The strcmp() function should be used instead.
But in rather weak-brained moment I wrote:
and it works.
The $Row[Type] is from a database and the $Type is from a $_POST var.
Both strings are extremely limited: will always be NO, GET or TTA.
So, anyway, I'm wondering why it works.
The strcmp() function should be used instead.
But in rather weak-brained moment I wrote:
Code: Select all
<?php
if ($RowїType] == "GET" && $Type == "NO")
{ // doesn't reall matter what it's doing
}
?>The $Row[Type] is from a database and the $Type is from a $_POST var.
Both strings are extremely limited: will always be NO, GET or TTA.
So, anyway, I'm wondering why it works.