Re: ways of making access and visib compat with 4 and 5

From: Date: Mon, 14 Mar 2005 12:26:58 +0000
Subject: Re: ways of making access and visib compat with 4 and 5
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-38892@lists.php.net to get a copy of this message
tony yau wrote:
hi all, I'm trying to make my classes compat with php4 and php5 is there a way of doing something like this: if( version== 4)
    define( "VISIBILITY", "" );
else if (version==5)
    define( "VISIBILITY", "protected" );
class Flex {
     VISIBILITY function CompatFunc();
}
this will never work. the if/else block is run _after_ the code is compiled. the line 'VISIBILITY function CompatFunc();' will always fail because php won't recognise the token 'VISIBILITY'. not that putting a constant where you do (even if it were defined) would work anyway. btw: you could/should have asked this question on php-generals (there's no reference to DB usage/problems in your question)

« previous php.db (#38892) next »