Veröffentlicht 5. September 200322 j hi leute, habe ein wenig probleme den === operator zu interpretieren. wann verwende ich diesen anstatt des == operators? PHP Manual: int strpos ( string haystack, string needle [, int offset] ) Note: It is easy to mistake the return values for "character found at position 0" and "character not found". Here's how to detect the difference: copy to clipboard // in PHP 4.0b3 and newer: $pos = strpos($mystring, "b"); if ($pos === false) { // note: three equal signs // not found... } // in versions older than 4.0b3: $pos = strpos($mystring, "b"); if (!is_integer($pos)) { // not found... } worin sind die unterschiede?? Viele Grüße kills
5. September 200322 j $a == $b Gleich Gibt TRUE zurück, wenn $a gleich $b ist. $a === $b Identisch Gibt TRUE zurück wenn $a gleich $b ist und beide vom gleichen Typ sind(nur PHP 4). aus http://www.php.net/manual/de/language.operators.comparison.php gruß gurkenpapst
6. September 200322 j Original geschrieben von gurkenpapst $a === $b Identisch Gibt TRUE zurück wenn $a gleich $b ist und beide vom gleichen Typ sind(nur PHP 4). aus http://www.php.net/manual/de/language.operators.comparison.php gruß gurkenpapst ah danke. heisst das jetzt das $a===$b true ist wenn z.b. beides ein integer ist?
8. September 200322 j Das ist richtig. $a===$ba prüft, ob inhalt und typ gleich sind. Wobei $a==$b vorher nötigenfalls noch eine Typumwandlung macht und dann den Inhalt vergleicht: 0=="" wird zu 0==0.
Archiv
Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.