I'm having the following issue: I am creating a visual calendar in php with the following code
<?php
class Calendar{
public $numberOfDays;
function _construct(){
$this->$numberOfDays = cal_days_in_month(CAL_GREGORIAN, date("m"), date("Y"));
}
public function drawCalendar(){
echo '<div class="month">';
for( $i=0; $i< $numberOfDays;$i++){
echo '<div class="day"></div>';
}
echo '</div>';
}
}
?>
The problem is somehow $numberOfDays is not available in the for loop ? And I am getting a Undefined variable: numberOfDays error. What am I doing wrong
_construct()change it to__construct()- Constructs require 2 underscores.