Downgrading Versions

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
zeveck
Forum Newbie
Posts: 15
Joined: Mon Oct 17, 2005 7:23 pm
Location: Mountain View, CA

Downgrading Versions

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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...
User avatar
zeveck
Forum Newbie
Posts: 15
Joined: Mon Oct 17, 2005 7:23 pm
Location: Mountain View, CA

Post 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?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

private is php5+ only
User avatar
zeveck
Forum Newbie
Posts: 15
Joined: Mon Oct 17, 2005 7:23 pm
Location: Mountain View, CA

Post by zeveck »

Is there an equiv in PHP4? Any links to PHP4 scoping modifiers?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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" ;)
Post Reply