Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The fact that PHP is a dynamic language and that "==" would automatically convert the types of both ends to a flat because of the "0e" prefix of the string is problematic. Perhaps it's a bug in the PHP source code.

See below.

		# the examples were essentially similar like this comparison.
		php > var_dump("0e462097431906509019562988736854" == "0e830400451993494058024219903391");
		bool(true)

		# md5() does return a string type, but just happens to start with "0e"
		php > var_dump(md5('240610708'));
		string(32) "0e462097431906509019562988736854"
		php > var_dump(md5('QNKCDZO'));
		string(32) "0e830400451993494058024219903391"

		# and if PHP treats them as floats instead of strings, they all evaluated to the same thing. float(0)
		php > var_dump(0e462097431906509019562988736854);
		float(0)
		php > var_dump(0e830400451993494058024219903391);
		float(0)
		php > var_dump(0e087386482136013740957780965295);
		float(0)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: