Indexing Arrays with Strings

来源:互联网 发布:淘宝客成交有多少佣金 编辑:程序博客网 时间:2024/04/29 16:14

<HTML><HEAD><TITLE>Figure 5-3</TITLE></HEAD><? /* ** fill in some information */ $UserInfo["Name"] = "Leon Atkinson"; $UserInfo["Location"] = "Martinez, California"; $UserInfo["Occupation"] = "Web Engineer";  /*The key() function returns the element key from the current internal pointer position.This function returns FALSE on error.   The pos() function returns the value of the current element in an array.   The reset() function moves the internal pointer to the first element of the array.This function returns the value of the first   element in the array on success, or FALSE on failure.*/

 for(reset($UserInfo); $key = key($UserInfo); next($UserInfo)) {  $value = pos($UserInfo);  print("$key is $value.<BR>/n"); }?></BODY></HTML>

原创粉丝点击