Home > Backend Development > PHP Tutorial > 获取数组中的元素_PHP

获取数组中的元素_PHP

WBOY
Release: 2016-06-01 12:30:23
Original
1011 people have browsed it



获取数组中的元素


 $monthName = array(
 /*定义$monthName[1]到$monthName[12]*/
  1=>"January", "February", "March",
  "April", "May", "June",
  "July", "August", "September",
  "October", "November", "December",
 /*定义$monthName["Jan"]到$monthName["Dec"]*/
  "Jan"=>"January", "Feb"=>"February",
  "Mar"=>"March", "Apr"=>"April",
  "May"=>"May", "Jun"=>"June",
  "Jul"=>"July", "Aug"=>"August",
  "Sep"=>"September", "Oct"=>"October",
  "Nov"=>"November", "Dec"=>"December",
 /*定义$monthName["Jan"]到$monthName["Dec"]*/
  "January"=>"January", "February"=>"February",
  "March"=>"March", "April"=>"April",
  "May"=>"May", "June"=>"June",
  "July"=>"July", "August"=>"August",
  "September"=>"September", "October"=>"October",
  "November"=>"November", "December"=>"December"
  );
 /*打印相关的元素*/
 print("Month 5 is " . $monthName[5]. "
\n");
 print("Month Aug is " . $monthName["Aug"] . "
\n");
 print("Month June is " . $monthName["June"] . "
\n");
?>

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template