首頁 > 後端開發 > php教程 > 获取数组中的元素_PHP

获取数组中的元素_PHP

WBOY
發布: 2016-06-01 12:30:23
原創
995 人瀏覽過



获取数组中的元素


 $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");
?>

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板