Tag Archives: php

PHP 5.4 released

PHP 5.4 just released a few days ago, it introduced new features I quite like: Short array syntax $langs = Continue Reading →

PHP成员函数中竟然也能用static声明变量

又发现一个PHP Feature,PHP成员函数中竟然也能用static声明变量。怎么想怎么奇怪,你都创建新实例了,怎么static还是有效?不过有时候还蛮有用的。 class static_var { function __construct($name) { $this->name = $name; } function output() { static $counter; $counter++; echo $counter.’|’.$this->name.’|'; Continue Reading →

Mac OS X 上构建 PHP5

在安装 PHP 前先安装 Mysql,Apache2 我用的是 Mac 内置的那个。下载 PHP 5.2.9 源码,然后执行: ./configure –prefix=/usr/local –with-iconv –with-gd –with-xmlrpc –enable-zip –with-openssl=/usr –enable-ftp –enable-sockets –enable-mbstring Continue Reading →