Home > php教程 > php手册 > php foreach 与数组使用

php foreach 与数组使用

WBOY
Release: 2016-06-13 11:16:53
Original
937 people have browsed it

 

今天这教程要告诉各位一个秘密哦,就是在php中不能使用关联数组,如下面的形式哦,我们不能用foreach 来显示指定的值.

 $gPurviews = array
   (
       array('key'=>'NEWS', 'name'=>'1231123'),
       array('key'=>'PRODUCT', 'name'=>'1231管理'),
       array('key'=>'COMPANY', 'name'=>'企业信息管理'),
       array('key'=>'JOB', 'name'=>'招聘管理'),
       array('key'=>'ORDER', 'name'=>'订单管理'),
       array('key'=>'GUESTBOOK', 'name'=>'留言管理'),
       array('key'=>'USER', 'name'=>'注册用户管理'),
       array('key'=>'USER', 'name'=>'用户管理')
   );
    foreach($gPurviews as $v1){
         foreach($v1 as $tarray){
             echo $tarray;         
       }     
 }
?>

好了看实例


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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template