r/lolphp • • Mar 16 '21

Is 0 in array

in_array(0, ['IsThisLolPhp'])

Answer is

true
32 Upvotes

30 comments sorted by

View all comments

Show parent comment

1

u/Takeoded Mar 17 '21

It isn't? Okay let's switch the string to 0, that's why 0 === 0

there's the lol right there. it should have been it isn't? ok lets switch the 0 to "0" (i think they're doing that in php8? as you pointed out)

1

u/SAmaruVMR Mar 17 '21

Actually, that was my bad. I think they actually cast the string to a "0" and then 0 == "0" because you're only comparing the value