Skip to content

Instantly share code, notes, and snippets.

<?php
$arr = array(77, 99, 44, 55, 22, 88, 11, 00, 66, 33);
function bubbleSort($arr) {
$length = count($arr);
for ($i = $length; $i > 1; $i--) {
for ($j = 0; $j < $i; $j++) {
if ($arr[$j] > $arr[$j + 1]) {
$tmp = $arr[$j];
<?php
class Link {
public $key;
public $value;
public $next = null;
public function __construct($key, $value) {
$this->key = $key;
$this->value = $value;
<?php
class Link {
public $key;
public $value;
public $next = null;
public function __construct($key, $value) {
$this->key = $key;
$this->value = $value;
<?php
class Link {
public $value;
public $next;
public function __construct($value) {
$this->value = $value;
}
<?php
class Link {
public $value;
public $next;
public function __construct($value) {
$this->value = $value;
}
<?php
class Link {
public $value;
public $next;
public $previous;
public function __construct($value) {
$this->value = $value;
$this->next = null;
<?php
class Queue {
private $_queueArr;
private $_front;
private $_rear;
private $_queueSize = 10;
public function __construct() {
set nocompatible
set nobomb
set ambiwidth=double
set encoding=utf-8
set termencoding=utf-8
set langmenu=zh_CN.UTF-8
language message zh_CN.UTF-8
set guifont=Droid\ Sans\ Mono:h12
set ts=4
set shiftwidth=4
<?php
class Socket {
private $_host = 'www.google.com.hk';
private $_port = '80';
private $_socket = null;
private $_timeout = 30;
private $_method = '';
private $_protocol = 'tcp';
HTTP/1.1 200 OK
Date: Fri, 09 Jul 2010 02:30:43 GMT
Server: BWS/1.0
Content-Length: 4185
Content-Type: text/html;charset=gb2312
Cache-Control: private
Expires: Fri, 09 Jul 2010 02:30:43 GMT
Set-Cookie: BAIDUID=5734F922761D06577D84C404645F2717:FG=1; expires=Fri, 09-Jul-40 02:30:43 GMT; path=/; domain=.baidu.com
P3P: CP=" OTI DSP COR IVA OUR IND COM "