Re: PHP4 and returning values from a function...

by "Billy O'Connor" <billyo(at)kennetweb.co.uk>

 Date:  Thu, 6 Jun 2002 22:55:44 +0100
 To:  "Michael Boyer" <galdor7(at)hotmail.com>,
<hwg-languages(at)hwg.org>
 References:  hotmail
  todo: View Thread, Original
Try replacing this:

$numberOfDays = calcNumberOfDays($month, $year)

with this:

$numberOfDays = calcNumberOfDays($month, $year);

You have forgotten to put a semi-colon at the end of this line.

ATB,

Bill.
--
Billy O'Connor

Kennet Web Limited
~~~~~~~~~~~~~~~~~~~
Web Design & Hosting
Solutions For Business
~~~~~~~~~~~~~~~~~~~~~
T: 07021 107 411
E: billyo(at)KennetWeb.co.uk
W: http://www.KennetWeb.co.uk

----- Original Message -----
From: "Michael Boyer" <galdor7(at)hotmail.com>
To: <hwg-languages(at)hwg.org>
Sent: Thursday, June 06, 2002 9:57 PM
Subject: PHP4 and returning values from a function...


> Hi.
>
> I'm new to PHP and I'm translating a huge amount of code from Javascript
to
> PHP (for reference this is the same code that was discussed in the posts
> concerning SSI and Javascript processing order). Thankfully, the two
> languages are very similar and it hasn't taken me long to get up to speed.
> However, on the test server I keep getting an error:
>
> "Parse error: parse error in c:\program files\apache
> group\apache\htdocs\calendar.php on line 16."
>
> So... looking at the code, here's what I have upto line 16:
>
> /*<?php
>
> function makeCalendar()
> {
>         file://todaysDate is an associative array of the day passed in
from
> inline PHP code called from the
>         $todaysDate = getDate();
>         $month = $todaysDate['month']; // The month is equal to the
"month"
> from the associative array todaysDate.
>         $year = $todaysDate['year']; // The year is equal to the "year"
from
> the associative array todaysDate.
>         echo "$month $year from the makeCalendar function.";
>         $dayloop=1; // Local variable to keep track of the number
iterations
> of the while loop and is used to represent what day of the week the loop
is
> on.
>         $days=1; // Local variable that is used to write the days of the
> month on the calendar.
>         $dayMonthStarts;
>         $numberOfDays;
>         $leapYear = isLeapYear(year);
>         $numberOfDays = calcNumberOfDays($month, $year) // Call the
function
> to calculate the number of days in the month.
>         $dayMonthStarts = determineCycles($year, $numberOfDays, $month );
//
> Call the function to determine where the year is on the 28 year cycle.
This
> function calls subfunctions to calculate the startDay of the month and
> return it to here.
>
> */
>
> My question is can you not assign a return value from a function to a
> variable as I do in lines 15 & 16 (ie: $variable = function(parameter1,
> parameter2); )?
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA