明天又开始上课了,预习了一部分知识,感觉php还是有些细节做得不好,不如js和c那么美,这几天的知识偏理论,都是些基础知识,看的像睡觉啊,练习题也不是很多,所以看过一遍之后只有一个大概的印象.
<?php $arr = array("E_ERROR", "E_WARNING", "E_PARSE", "E_NOTICE", "E_CORE_ERROR", "E_CORE_WARNING", "E_COMPILE_ERROR", "E_COMPILE_WARNING", "E_USER_ERROR", "E_USER_WARNING", "E_USER_NOTICE","E_STRICT","E_ALL"); $str = "<table width=‘350‘ border=‘1‘ align=‘center‘>"; $str .= "<tr><td>错误代号(常量)</td><td>十进制值</td><td>二进制值</td></tr>"; foreach($arr as $value){ $a = $value; $b = constant($a); $c = decbin($b); $c = str_pad($c,16,"0",STR_PAD_LEFT); $c = str_replace("1","<font color=‘red‘>1</font>",$c); $str .= "<tr>"; $str .= "<td>$value</td><td>$b</td><td>$c</td>"; $str .= "</tr>"; } $str .= "</table>"; echo $str; ?>
时间: 2024-12-09 18:05:49