Well I have a function getDaysTotal in my model say estimate.php.
If in my view.php if I use
echo $model->DaysTotal; 
I get the value 3. But if I do it again
echo $model->DaysTotal;
Now I get 1. Any idea, why I am getting it like this. This is happening for any function in estimate.php. If I am using it for second time the result is weird.
Am I doing anything wrong here? How can I correct this? Thanks.
Here is the code for getTotalDays function:
public function getDaysTotal() {
               $this->discharge_date = strtotime($this->discharge_date);
               $this->admission_date = strtotime($this->admission_date);
               $datediff = ($this->discharge_date - $this->admission_date);
               $fraction_days = ($datediff/(60*60*24));
               if ($fraction_days < 1){
                          return 1;
               }elseif(($datediff)%(60*60*24) < 10800){
                 $option2 = floor($datediff/(60*60*24));
                 return $option2;
               }elseif(($datediff%86400) > 10800 && ($datediff%86400)<21600) {
                  $option3 = ceil($datediff/(60*60*24)*2)/2;
                  return $option3;
               }elseif (($datediff%86400) >21600){
                   $option4= ceil($datediff/86400);
                   return $option4;
               } 
 
     
     
    