Echo array output in php?

  • Thread starter Thread starter yeoys2003
  • Start date Start date
Y

yeoys2003

Guest
Im using array instead of database to store my data.

$people = array(
"1" => array("name"=>"Alan", "age"=>"23", "state"=>"New York"),
"2" => array("name"=>"Bryan", "age"=>"43", "state"=>"Ohio"),
"3" => array("name"=>"Cody", "age"=>"21", "state"=>"New York"),
"4" => array("name"=>"Daniel", "age"=>"34", "state"=>"Seattle"),
"5" => array("name"=>"Eddy", "age"=>"24", "state"=>"California")
);


I will need the php codes of how to get these 3 outputs.

How do i generate the list of name, age and state of the 3 latest people added to the array so that i get this
Cody, 21, New York
Daniel, 34, Seattle
Eddy, 24, California


How do i generate a list of names whereby their names ends with a "Y"?
Cody, 21, New York
Eddy, 24, California

Lastly, how do i generate the names of the people who are from the state, New York for example so i get this
Alan, 23
Cody, 21

Please dont refer me to php.net, i juz need the exact codes for these. Thanks
 
Back
Top