Your problem lies in these lines
  Return $realday;
  Return $month;
  Return $year;
and
  Datereturn();

A function can only return one "value" - that value can be an array (see
later)

To use the returned value, you need to assign it to something (or use it
directly)

So, change your return to this:
  Return array($realday, $month, $year);

and then change this line
  Datereturn();
to either
  $tmp = Datereturn();
  $realday = $tmp[0];
  $month   = $tmp[1];
  $year    = $tmp[2];
Or this (which I think is a better way)
  list($realday, $month, $year) = Datereturn();


HTH
Martin


-----Original Message-----
From: Simonk [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 05, 2002 1:21 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Help with " Function " parameter


I have programed a function for counting Date:

function Datereturn()
  {
   $monthorder = Array ( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
    $day = Date("j");
    $monthday = Date("t");
  $month = Date("n");
  $year = Date("Y");
  $current = 42 - ($monthday - $day);
  if ($current > $monthorder[$month])
   { $realday = $current - $monthorder[$month];
    $month = $month + 2;
     if ($month > 12)
      { $year = $year + 1;
       $month = $month - 12; }
                   }
  else
   { $realday = $current;
    $month = $month + 1;
     if ($month > 12)
      { $year = $year + 1;
       $month = $month - 12; }   }
  Return $realday;
  Return $month;
  Return $year;
           }


But when I want to echo out the result, I have typed:

Datereturn();
echo "$year, $month, $realday";

Then the server return:
Undefined variable year, month, realday

plz help!





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to