Zum Inhalt springen

Empfohlene Beiträge

Geschrieben

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

Geschrieben

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.

Erstelle ein Benutzerkonto oder melde Dich an, um zu kommentieren

Du musst ein Benutzerkonto haben, um einen Kommentar verfassen zu können

Benutzerkonto erstellen

Neues Benutzerkonto für unsere Community erstellen. Es ist einfach!

Neues Benutzerkonto erstellen

Anmelden

Du hast bereits ein Benutzerkonto? Melde Dich hier an.

Jetzt anmelden

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...