pixeltrace Posted August 15, 2008 Share Posted August 15, 2008 hi, i need help i used the self function in my php code <?php self::show_prev_next_2($programmes_selected, $month_selected, $year_selected, $Itemid); ?> i tested this in my test server, which is using php 5.0.4 now, when i upload it into the live server which is using php 4.4.7 i am getting undefined class name "self" when i tried changing it to $this->show_prev_next_2($programmes_selected, $month_selected, $year_selected, $Itemid); i got this new error Fatal error: Call to a member function on a non-object in /home/manym4/public_html/sinagtala.net/jm/components/com_events/events.html.php on line 750 hope you could help me with this. thanks! Quote Link to comment https://forums.phpfreaks.com/topic/119821-need-help-on-my-php-code/ Share on other sites More sharing options...
MasterACE14 Posted August 15, 2008 Share Posted August 15, 2008 OOP came in late PHP 4/early PHP 5 I believe. So nothing to do with OOP will work on your current version.(I may be wrong however) Quote Link to comment https://forums.phpfreaks.com/topic/119821-need-help-on-my-php-code/#findComment-617293 Share on other sites More sharing options...
wildteen88 Posted August 15, 2008 Share Posted August 15, 2008 The keyword self:: is not supported by PHP4.x. It is only available for PHP5. PHP4 has very limited OOP support. You should check the manual to see what PHP4 and PHP5 support. Quote Link to comment https://forums.phpfreaks.com/topic/119821-need-help-on-my-php-code/#findComment-617333 Share on other sites More sharing options...
pixeltrace Posted August 16, 2008 Author Share Posted August 16, 2008 yah, i've read that the self keyword doesnt work on php 4 is there anyone who got a solution for this? because i also tried replacing self:: with $this-> but still it doesnt work and is giving me a different error. hope you could help me with this. thanks! Quote Link to comment https://forums.phpfreaks.com/topic/119821-need-help-on-my-php-code/#findComment-618002 Share on other sites More sharing options...
wildteen88 Posted August 16, 2008 Share Posted August 16, 2008 Use your class name instead, eg your_class_name:: Quote Link to comment https://forums.phpfreaks.com/topic/119821-need-help-on-my-php-code/#findComment-618011 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.