Page 1 of 1

Downgrading Versions

Posted: Wed Jan 11, 2006 4:54 pm
by zeveck
I have been developing a webapp in PHP5, but found that most hosting services seem to require PHP4. What pitfalls should I look for when trying to run my PHP5 code on PHP4? Common work-arounds?

The only one I've noticed thus far is that PHP 4.3.11 doesn't seem to have real booleans - can I just define "true" and "false" as global constants? How would I do that in PHP?

Posted: Wed Jan 11, 2006 5:07 pm
by feyd
php4 has always had "real" boolean types. :?

It may be best to read this, but reverse it. :)

The basics: there's a host of functions you'll need to backport (pear has a compatibility layer for this), class definitions are quite different (less magic functions), be careful of reference based things. Object handling is quite different. The list goes on and on...

Posted: Wed Jan 11, 2006 5:16 pm
by zeveck
Well, I get the error:
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in public_html/inc/DBCxn.inc on line 16
The offending line is:
private $host_ = false;
I assumed the problem was that "false" wasn't defined?

Posted: Wed Jan 11, 2006 6:02 pm
by John Cartwright
private is php5+ only

Posted: Wed Jan 11, 2006 7:17 pm
by zeveck
Is there an equiv in PHP4? Any links to PHP4 scoping modifiers?

Posted: Wed Jan 11, 2006 9:59 pm
by feyd
public, protected and private keywords do not exist in php 4. There is no equivalent. 4's objects are completely open classes (public) .. as an analogy to C, it's a struct "object" ;)