Jump to content

audittr180

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

audittr180's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i have the following array $fruits = array("cherry" => "red", "apple" => "red", "kiwi" => "green", "strawberry" => "red", "pear" => "yellow", "melon" => "green", "grapes" => "green", "watermelon" => "red", "banana" => "yellow") using the array_count_values($fruits) i get Array ( => 4 => 3 [yellow] => 2 ) how can i asign the value of each key to a variable?
  2. i have the following array $fruits = array("cherry" => "red", "apple" => "red", "kiwi" => "green", "strawberry" => "red", "pear" => "yellow", "melon" => "green", "grapes" => "green", "watermelon" => "red", "banana" => "yellow") using the array_count_values($fruits) i get Array ( => 4 => 3 [yellow] => 2 ) how can i asign the value of each key to a variable?
  3. I want to print in an html table the Seasons,the Months,and the days of each month. the following code prints the seasons and the days i need another foreach in between that prints the months also Any ideas??? Please help... $seasons=array ( "Fall"=> array ("September"=>"30","October"=>"31","November"=>"30"), "Winter"=> array ("December"=>"31","January"=>"31","February"=>"28"), "Spring"=> array ("March"=>"31","April"=>"30","May"=>"31"), "Summer"=> array ("June"=>"30","July"=>"31","August"=>"31") ); $tab = "<table border=\"1\">"; foreach($seasons as $season => $months) { $tab .= "<tr><td colspan=\"4\">$season</td></tr>" ; $tab .= "<tr>" ; foreach($seasons[$season] as $days) { $tab .= "<td>$days</td>" ; } $tab .= "</tr>" ; } $tab .= "</table>" ; echo $tab ;
×
×
  • 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.