摘要:
1 <?php 2 function myMbSubstr($str, $start, $length, $charset){ 3 $charsets["utf-8"] = $charsets["utf8"] = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/"; 4 $charsets["gb2312"] = "/[\x01-\x7f]|[\xb0-\xf7][\xa 阅读全文
摘要:
1 <?php 2 $arr1 = array(1, 3, 5, 8, 9); 3 $arr2 = array(1, 3, 4, 7, 9); 4 $intersaction= array(); 5 foreach($arr1 as $val) { 6 if(in_array($val, $arr2)) $intersaction[] = $val; 7 } 8 9 var_dump($intersaction);10 ?>输出array(3) { [0]=> int(1) [1]=> int(3) [2]=> int... 阅读全文
摘要:
客户端发送SYN给服务器服务器发送SYN+ACK给客户端客户端发送ACK给服务器连接建立,调用accept()函数获取连接 阅读全文
摘要:
1 <?php 2 # 双向队列 3 class Deque { 4 public $queue = array(); 5 6 public function frontAdd($obj) { 7 array_unshift($this->queue, $obj); 8 } 9 10 public function frontRemove() {11 return array_shift($this->queue);12 ... 阅读全文