Created
May 24, 2012 10:47
-
-
Save ondrejmirtes/2780794 to your computer and use it in GitHub Desktop.
PHP WTFs - in_array()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$keys = array( | |
'scheme', | |
'user', | |
'pass', | |
'host', | |
'port', | |
'path', | |
'query', | |
'fragment', | |
); | |
dump(in_array(0, $keys)); // TRUE! |
Žádná záhada se nekoná. To je stejný jako
'scheme' == 0; // TRUE
všechno vyřeší třetí argument in_array
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
vždy je lepší být striktní :)