After following, you can keep track of his dynamic information in a timely manner
Courses in the relevant section:php array definition
<pre></pre>标准化输出 var_dump() 能打印出类型 print_r() 只能打出值 echo() 是正常输出... 需要精确调试的时候用 var_dump(); 一般查看的时候用 print_r() 另外 , echo不能显示数组 其余2个可以...
2017-11-290个赞
Courses in the relevant section:PHP list, each function traverses the array
<?php $arr=array( '教学部'=>array( array('李某','18','人妖'), array('高某','20','男'), array('张某','21','妖人'), ), '宣传部'=>array( array('李某','18','人妖'), array('高某','20','男'), array('张某','21','妖人'), ), '财务部'=>array( array('李某','18','人妖'), array('高某','20','男'), array('张某','21','妖人'), ), ); while(list($key,$value)=each($arr)) { echo '<h1 align="center">'.$key.'</h1>'.'<table width="1000px" align="center" border="1px">'; while(list($key1,$value1)=each($value)) { echo '<tr>'; foreach($value1 as $realk => $realv) { echo '<td align="center">'.$realv.'</td>'; } echo '</tr>'; } echo '</table>'; } ?>
2017-11-290个赞
Courses in the relevant section:PHP commonly used array manipulation functions
三种输出区别 <?php $mingren = array("邓超", "黄晓明", "宁泽涛", "钟汉良"); $dc = array_shift($mingren); echo $dc .'<br />'; echo '<pre>'; print_r($mingren); var_dump($mingren); echo $mingren; echo '</pre>'; ?>
数组的遍历: 1、foreach($arr as $key=>$value) { } 2、while(list($key,$value)=each($array)) {} each执行一次,指针往后移动一次,知道完全遍历返回false; each将数组拆分为,[0]键值[1]数组值$key键值$value数组值; list第一个键值对应[0],第二个对应[1]; php 输出,现在接触到的,echo print_r var_dump
2018-01-300个赞
Courses in the relevant section:Metacharacters in php regular representation
()中的内容只要匹配成功,就将结果放到key为1的数组元素中
2017-11-290个赞
Courses in the relevant section:PHP uses regular expressions to write a UBB text editor
()中的匹配项将放到数组中,问题是$1和\\1有什么不同?
2017-11-300个赞