News for hackers. Stuff that matters.
Re:Python is the new BASIC by imakesnowflakes on Friday July 31, 2015 @05:11PM (#9984521)
>It will still work calling $a['1'] with the quotes so what exactly is the issue?

Oh yea. Try this.

    $a = array ('1' => 'one');

    foreach ($a as $k=>$v) {

    if ($a === '1') {

      echo "found one";

    }

    }
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

Re:Python is the new BASIC by codygman on Friday July 31, 2015 @07:11PM (#9985054)
from that post:

> Bad idea? Sure. But once you know the enemy you can deal with it

Why surround yourself with more enemies than those that inherently exist in your business logic/problem domain? The problem with PHP is all of those "no big deal tiny issues" add up to something reminiscent of death by 1000 papercuts.

Re:Python is the new BASIC by imakesnowflakes on Friday July 31, 2015 @07:38PM (#9985141)
A correction. it is

    if ($k === '1') instead of if ($a === '1')..