PHP: md5('240610708') == md5('QNKCDZO')
111–120 of 185 posts
Re: PHP: md5('240610708') == md5('QNKCDZO')
#112Earlier quoted context omitted.
There are a couple of things we have learnt in our collective 50+ years of software engineering: 1. Code is not English: Nice try COBOL, and someone had to try, but a failed experiment. Bizarre holdouts: SQL 2. People are not idiots, and will not collapse into a gibbering heap if their programming language insists that 0 and "0" are different things and must be managed accordingly. Bizarre holdouts: PHP, Javascript.…
Absolutely, to be fair to JS, Eich admitted it was an horrible mistake, and tools like JSlint enforce the use of === . I didn't see any meaculpa from the PHP team yet.Would like to read about it.
Re: PHP: md5('240610708') == md5('QNKCDZO')
#113Earlier quoted context omitted.
> They were put in so that things would behave the way a novice expects them to (3 == '3') It's a very wrong approach. It may look like newbie-friendly, but in fact it makes it much harder to learn and use. Any novice will be constantly attempting to form a mental model of what's going on and how the language interprets concepts. Refusing to do things like 3 == '3' is simple and makes sense. Assuming a programmer is…
It's hard for newbies who want to master the language. It's not hard for people who have no interest in learning a programming language and just wan't to make the thingy in their HTML do some stuff. Register globals, and be done. We have to remember the PHP origins and audience from way back to understand why this was considered easy to use.
Not that this is particularly important, I guess.
Re: PHP: md5('240610708') == md5('QNKCDZO')
#114Earlier quoted context omitted.
Yeah, documentation is for pussies.
Here is one PHP core developer claiming that PHP documentation is wrong, even on fundamental things... http://www.reddit.com/r/lolphp/comments/2md8c0/new_safe_cast... Just saying....
Re: PHP: md5('240610708') == md5('QNKCDZO')
#115I'm not exactly clear on how PHP == works, but you can see the MD5 for yourself: $ echo -n 240610708 | md5sum 0e462097431906509019562988736854 - $ echo -n QNKCDZO | md5sum 0e830400451993494058024219903391 - $ echo -n aabg7XSs | md5sum 0e087386482136013740957780965295 - All of them start with 0e, which makes me think that they're being parsed as floats and getting converted to 0.0. This is why "magic" operators like =…
This, combined with the fact that you can increment strings gives some 'interesting' results: $a = "2d9"; $a++; echo $a . "\n"; $a++; echo $a . "\n"; Output 2e0 3
Re: PHP: md5('240610708') == md5('QNKCDZO')
#116I'm not exactly clear on how PHP == works, but you can see the MD5 for yourself: $ echo -n 240610708 | md5sum 0e462097431906509019562988736854 - $ echo -n QNKCDZO | md5sum 0e830400451993494058024219903391 - $ echo -n aabg7XSs | md5sum 0e087386482136013740957780965295 - All of them start with 0e, which makes me think that they're being parsed as floats and getting converted to 0.0. This is why "magic" operators like =…
Ahh PHP, the language where true == false php > if ((true == "foo") && ("foo" == 0) && (0 == false)) echo "yay!"; yay!
Re: PHP: md5('240610708') == md5('QNKCDZO')
#117Re: PHP: md5('240610708') == md5('QNKCDZO')
#118One thing to note. The md5 and sha1 interfaces have a second param which prevents this bug. Instead of returning a string it will return binary data which won't get coerced to a float. For example: PHP has a lot of.....PHPisms.
Re: PHP: md5('240610708') == md5('QNKCDZO')
#119I'm not exactly clear on how PHP == works, but you can see the MD5 for yourself: $ echo -n 240610708 | md5sum 0e462097431906509019562988736854 - $ echo -n QNKCDZO | md5sum 0e830400451993494058024219903391 - $ echo -n aabg7XSs | md5sum 0e087386482136013740957780965295 - All of them start with 0e, which makes me think that they're being parsed as floats and getting converted to 0.0. This is why "magic" operators like =…
This, combined with the fact that you can increment strings gives some 'interesting' results: $a = "2d9"; $a++; echo $a . "\n"; $a++; echo $a . "\n"; Output 2e0 3
Re: PHP: md5('240610708') == md5('QNKCDZO')
#120Earlier quoted context omitted.
This, combined with the fact that you can increment strings gives some 'interesting' results: $a = "2d9"; $a++; echo $a . "\n"; $a++; echo $a . "\n"; Output 2e0 3
Who tries to increment strings anyway? What is your point here?