first PHP4/5 difference I've noticed
I just spent a half hour narrowing down a bug in an application I’d fut some polishing touches on in PHP5. When it was moved onto the production server earlier, it came up with blank pages. I wasn’t on hand to check it out, so couldn’t help over the phone. I had to wait until I could get to a computer to debug it.
The end problem was in a line similar to the following:
$n=$db->query('select id from some_table')->numRows();
The above worked in every server I had available – except the one it was supposed to go on.
To get that code working in PHP4, you must break the object results down:
$n=$db->query('select id from some_table'); $n=$n->numRows();
It’s an annoyance – but at least it’s not a large thing to fix, and the lines that need changing can easily be found by grep
ping for numRows()
.
Interesting. Is lack of backwards compatibility going to be one of PHP5’s features?
It’s the other way around, hostyle – I was writing code for PHP5, but the code didn’t work in PHP4. No biggie – it’s a small difference, but I was suprised by it anyway, as I had not come across any other differences up until then.
ah yes, speed reading does let me down now and then š