网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站设计 > PHP
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   IP: 49.87.51.43
Old 2016-02-23, 08:54 PM
Kayson Kayson is offline
初级会员
 
Join Date: 2010-06-08
Posts: 1
Kayson 现在声名狼藉
Default Php数组输出三种形式 php打印数组

$bbbb=array("11"=>"aaa","22"=>"bbb");
//方式一:只能输出值value不能输出key
foreach($bbbb as $color)
echo $color;


//方法二:value与key都可输出
foreach($bbbb as $key=>$value)
echo $key."=>".$value;


//方法三:value与key都可输出
while($color=each($bbbb)){
echo $color['key'];
}


print_r()

var_dump()

<?
$a = array (1, 2, array ("a", "b", "c"));
var_dump ($a);
?>

输出结果:
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
array(3) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
}
}
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 11:08 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.