lowe_22 Posted March 19, 2008 Share Posted March 19, 2008 Hi, I have recently written this class to create drop down select boxes using PHP 5. I then discovered that my webhost runs only PHP4. The probelm is, I dont' know the differences between PHP4 and PHP5 thus I have no idea how to get this class working in PHP4! If anyone has any ideas, please do let me know! Code below. <?php //Define Dates class DateViewHelper { static $MONTHS = array( "January", "Febreuary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ); satic $DAYS = array( "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"); static function yearPulldown ($from, $to, $selected ){ $ret = ""; for ( $x = $from; $x <= $to; $x++ ) { $ret .= "<option"; $ret .= ($x == $selected )?' selected="selected"':""; $ret .= ">$x</option>\n"; } return $ret; } static function monthPulldown( $selected ) { for ( $x=1; $x <= 12; $x++ ) { $ret .= "<option value=\"$x\""; $ret .= ( dateViewHelper::$MONTHS[$x-1] == $selected )?' selected="selected"':""; $ret .= ">".dateViewHelper::$MONTHS[$x-1]."</option>\n"; } return $ret; } static function dayPulldown ( $selected ) { for ( $x=1; $x <= 31; $x++ ) { $ret .= "<option value=\"$x\""; $ret .= ($x == $selected )?' selected="selected"':""; $ret .= ">$x</option>\n"; } return $ret; } } ?> Link to comment https://forums.phpfreaks.com/topic/96871-need-to-make-this-class-work-in-php4/ Share on other sites More sharing options...
Cep Posted March 19, 2008 Share Posted March 19, 2008 satic $DAYS = array( That won't work for starters Check this out http://www.php.net/manual/en/language.oop.php Link to comment https://forums.phpfreaks.com/topic/96871-need-to-make-this-class-work-in-php4/#findComment-495732 Share on other sites More sharing options...
lowe_22 Posted March 19, 2008 Author Share Posted March 19, 2008 Yea typo, meant to read "static". I realise that static variables and functions don't work in PHP4 - but thats the point i'm trying to make, how can I create a similarly working script without use of 'static'? Link to comment https://forums.phpfreaks.com/topic/96871-need-to-make-this-class-work-in-php4/#findComment-495745 Share on other sites More sharing options...
uniflare Posted March 19, 2008 Share Posted March 19, 2008 im not sure but doesnt var work instead of static for php4? Link to comment https://forums.phpfreaks.com/topic/96871-need-to-make-this-class-work-in-php4/#findComment-495746 Share on other sites More sharing options...
PFMaBiSmAd Posted March 19, 2008 Share Posted March 19, 2008 While this won't directly solve your problem, the end of life of php4 has already gone past. The final bug fixes were released on Jan 3, 2008 and support for it will stop on Aug 8, 2008. It is an obsolete product. Your web host should have php5 available, either through your control panel or a .htaccess file setting or they should have a specific schedule for switching to php5. Check with them on how to select php5 or when they expect to provide it. Link to comment https://forums.phpfreaks.com/topic/96871-need-to-make-this-class-work-in-php4/#findComment-495810 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.