Danny620 Posted December 16, 2009 Share Posted December 16, 2009 <?php class Building{ public $name; public $current = 1; public $upgrade; function Upgrade(){ $this->upgrade = $this->current + 1; } function get_upgrade(){ return $this->upgrade; } } $Building = new Building(); $upgrade = $Building->get_upgrade(); echo $upgrade; ?> it should return 2 but it dont Quote Link to comment https://forums.phpfreaks.com/topic/185392-help-need/ Share on other sites More sharing options...
ignace Posted December 16, 2009 Share Posted December 16, 2009 $Building = new Building(); $Building->Upgrade(); $upgrade = $Building->get_upgrade(); Quote Link to comment https://forums.phpfreaks.com/topic/185392-help-need/#findComment-978717 Share on other sites More sharing options...
Danny620 Posted December 16, 2009 Author Share Posted December 16, 2009 ah so you have to call the upgrade function first thanks Quote Link to comment https://forums.phpfreaks.com/topic/185392-help-need/#findComment-978731 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.