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 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(); 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 Link to comment https://forums.phpfreaks.com/topic/185392-help-need/#findComment-978731 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.