NIHKLAS

October 29, 2025, 10:10 am • (updated)

Ein Zitat von Claude Sonnet 4.5:
Frage: "how is the strict equality check with two arrays? is it compared on values?"
Antwort: (gekuerzt)
...
// ❌ Numeric string keys vs int keys
$a = [0 => 'a', 1 => 'b'];
$b = ['0' => 'a', '1' => 'b'];
var_dump($a === $b); // false (int keys vs string keys)

Das ist alles in einer Antwort btw
...
// 3. Numeric string keys are converted to int!
$a = ['0' => 'a', '1' => 'b'];
$b = [0 => 'a', 1 => 'b'];
var_dump($a === $b); // true (PHP converts '0' -> 0 for keys)

Shepado's profile picture
Random_Nitro_Crate's profile picture

Liked by Shepado and

Comments

You must be logged in to comment.


Random_Nitro_Crate #1

October 30, 2025, 12:35 pm

Frage ist: werden Numerische String Values dann auch in int gecastet oder nicht?

Shepado #1

October 29, 2025, 10:14 am

Just do it urself man

NIHKLAS

October 29, 2025, 10:13 am

Laut 3v4l.org ist btw der zweite Teil richtig, also PHP converted numerische Keys immer in integer

the more you know

Shepado's profile picture
Uncle_M's profile picture

Liked by Shepado and

NIHKLAS

October 29, 2025, 10:11 am

Alles aus einer Antwort btw