|
|
|
|
|
by bite_victim
3971 days ago
|
|
Isn't the word 'array' quite obvious that it will create an array? Since PHP 5.4 you actually have the shorthand "[]" version available but it is still obvious to anyone who is using PHP or JavaScript (though JS arrays aren't hash maps like PHP's -- you need an object for that). But I agree, it's crystal clear for anyone with a minor PHP knowledge. For the rest it's just "clear". (It will still work calling $a['1'] with the quotes so what exactly is the issue? If you mean the drawbacks of type coercion not sure if this example is the best one.) |
|
Oh yea. Try this.
Surprise! Never prints "found one".THAT is the issue! I used '===' so I should be safe from type coercion issues, right? Well, a hidden rule in php says no.
See this bug..oops feature, when it bit even experienced php programmers here
https://www.reddit.com/r/PHP/comments/2zhg6z/how_true_is_thi...
See that post and the comment from the user e-tron. Both of them who are experienced php programmers