Using php foreach with array_PHP tutorial

WBOY
Release: 2016-07-20 11:00:17
Original
1013 people have browsed it

Today’s tutorial will tell you a secret, that is, you cannot use associative arrays in PHP, as shown below. We cannot use foreach to display the specified value.

$gPurviews = array
(
array('key'=>'NEWS', 'name'=>'1231123'),
array('key'=>'PRODUCT', 'name'=>'1231 Management'),
array('key'=>'COMPANY', 'name'=>'Enterprise Information Management'),
         array('key'=>'JOB', 'name'=>'Recruitment Management'),
​​​ array('key'=>'ORDER', 'name'=>'Order Management'),
         array('key'=>'GUESTBOOK', 'name'=>'Message Management'),
​​​ array('key'=>'USER', 'name'=>'Registered User Management'),
array('key'=>'USER', 'name'=>'User Management')
);
foreach($gPurviews as $v1){
foreach($v1 as $tarray){
                   echo $tarray;                                                                                           }
?>

Okay, let’s look at the example


http://www.bkjia.com/PHPjc/445513.html

truehttp: //www.bkjia.com/PHPjc/445513.htmlTechArticleToday this tutorial will tell you a secret, that is, associative arrays cannot be used in php, as shown below , we cannot use foreach to display the specified value. $gPurviews = array ( array...
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!