News Feed
Sections
News Archive


Community Events






feed this:

PHPEverywhere:
Octalpussy
0 comments :: posted Monday February 04, 2008 @ 10:25:00
voice your opinion now!

In an earlier post John Lim pointed out an interesting issue with how certain numbers are handled in PHP - ones starting with a zero:

That's because any number preceded by 0 is treated as an octal number, and 9 is an invalid octal number. [...] The silly thing is that hardly anyone uses octal nowadays, but it continues to be part of the C, C++, Java and PHP standards. The mistake is also very common.

There's not much way around it, he notes - the format's been in use for a long time now and is so ingrained in just about every C-based language out there that it's "too deeply imprinted in modern compiler DNA" to take out.

tagged with: octal number bug base8 adodb


PHPEverywhere:
Octopussy numbers in PHP
0 comments :: posted Friday February 01, 2008 @ 09:21:00
voice your opinion now!

John Lim has posted about an interesting bug he's come across when working with the output of two strings that should look the same:

Someone reported a bug in ADOdb, the open source db library i maintain. I went crazy for half an hour until i realised the problem.

According to him, "if you expect the above code to produce the same values, you are sadly mistaken". His example gives an interesting result for the first echo statement - not echoing the 9 in the first character like it seems would make sense. Check out his post for the code and try it out for yourself.

tagged with: number echo adodb database gotcha


conference application release job mysql code package PHP5 framework ajax database security developer PEAR releases cakephp zendframework pecl book zend

All content copyright, 2008 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework