RE: [PHP] Help with " Function " parameter
| From: | Maxim Maletsky | Date: | Fri, 05 Apr 2002 01:08:10 +0000 |
| Subject: | RE: [PHP] Help with " Function " parameter | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-91653@lists.php.net to get a copy of this message | ||
Turn error_reporting to:
error_reporting (E_ERROR | E_WARNING | E_PARSE);
// that is the function to mess in the code, you can also set it within
php.ini
then fix your function:
It cannot have more then one return (sure it can, but will break the
execution on the first-come basis).
If you need them all three then make yourself an array and return it:
Function return_array() {
....
Return Array('date'=>$date, 'time'=>$time, 'year'=>$year);
}
or, make those three variables global;
Function return_array() {
Global $realday, $month, $year; // add this line and your
function will work
....
Return True; // is enough
}
Sincerely,
Maxim Maletsky
Founder, Chief Developer
PHPBeginner.com (Where PHP Begins)
maxim@phpbeginner.com
www.phpbeginner.com
> -----Original Message-----
> From: Simonk [mailto:fong@btinternet.com]
> Sent: Thursday, April 04, 2002 5:39 PM
> To: php-general@lists.php.net
> 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