Code: Select all
Example #1:
class Test {
function get_month() {
$todays_date = getdate();
return 'This month is '. $todays_dateї'month'];
}
}
$t = new Test;
print $t->get_month();
//output:
This month is JulyCode: Select all
Example #2:
class Test {
var $todays_date;
function get_month() {
$this->$todays_date = getdate();
return 'This month is '. $this->$todays_dateї'month'];
}
}
$t = new Test;
print $t->get_month();
//output:
This month is ArrayWhy does Example #2 not work correctly, and what approach do I need take to remedy this?
-Ryan