I'm working on some new components in my framework for a gettext implementation. It needs to support the dead php4 and php5+. I'm using Zend_Translate and I will implement a gettext based class for php4.
I'm wondering if it's ok to rely on the phpversion function to branch out on which class to implement. Something like...
$version = phpversion();
define('VERSION', grabVersion($version) ); // grab major version
if ( VERSION >= 5 ) {
$local = new Zend_Translate();
} else {
$local = new Gettext();
}
Both classes have a _
function to do the translations, so the rest should be the same.
<label for="first_name"><?php echo $local->_("First Name");?></label>
Is it common to do so in any of the major php frameworks, would you do something similar if you were forced to support the dead PHP4?