Jump to content

problem with foreach() function


ardyandkari

Recommended Posts

hello...i am trying to use the foreach() function to no avail.

 

here is my code:

		foreach (($arrayfrom as $key1 => $arrfrom) && ($arrayto as $key2 => $arrto))
		{
		if (($count >=($arrfrom)) && ($count <= ($arrto)))
			{echo "<td bgcolor='#000000'>".$dayArray["mday"]."    </td>\n";
			$start += ADAY;
			}

 

i get the following error:

Parse error: syntax error, unexpected T_AS in C:\wamp\www\resort\literes\test.php on line 132

 

what am i doing wrong?  i have $arrayfrom and $arrayto defined above as an array()...i tried taking out && ($arrayto as $key2 => $arrto) and it still comes up with the same error...kinda confused :-\  .......

Link to comment
https://forums.phpfreaks.com/topic/121141-problem-with-foreach-function/
Share on other sites

ok...

 

MasterACE14:

i tried with one array and got the same error.  also, at php.net, it is a lowercase as.

 

PFMaBiSmAd :

thank you for that, but i have already been to php.net and know about foreach... you can also do this

foreach (array_expression as &$value)

got that from php.net too...doesnt help much though...

 

i got it to work...sort of.

 

still doubles the number of days in the calendar...so i am scrapping that idea and will try again later.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.