PHP4.4.9リリース
今日2008/08/08はPHP4のEOL。ということで、PHP4系の最終版4.4.9のリリースです。
The PHP development team would like to announce the immediate availability of PHP 4.4.9. It continues to improve the security and the stability of the 4.4 branch and all users are strongly encouraged to upgrade to it as soon as possible. This release wraps up all the outstanding patches for the PHP 4.4 series, and is therefore the last PHP 4.4 release.
いろいろとPHP4にはお世話になりました。「ありがとう」というか「お疲れさん」というか。。。
でも、まだしばらくは送別できないー!><
「地震」そのとき
via . Yahoo!の日本語形態素解析Webサービスを使ってTwitterで流行っているキーワードをクラウド化 - Do You PHP はてな
今日13時前のtwitterのタイムラインが。。。
思いっきり出てるなぁ。
PHP5.3.0α2は2008/08/28リリース
の予定のようです。
After speaking with several people about their todo items [1], Johannes and I have settled on the 28th of August for the alpha2 release. We will package on the 27th. Seems like we have a good chance for getting the open items completed by then.
CentOS4.6でPHP4.0.0をbuildしてみた
buildしてphpinfo出して懐かしんで終了。
Apache2はまだサポート(というかリリースも?)されてなかったんだなぁ。。。あと、使える拡張モジュールが少なすぎ!
追記(2008/08/10 21:50)
イースターエッグは。。。
typesafeな定数
typesafeな定数については、型に安全な定数あたりを参照。Java5以前だと
public final class Card { private String name; public static final Card CLUBS = new Card('clubs'); public static final Card DIAMONDS = new Card('diamonds'); public static final Card HEARTS = new Card('hearts'); public static final Card SPADES = new Card('spades'); private Card(String name) { this.name = name; } public function toString() { return this.name; } }
な感じのコードでtypesafeな定数を実現できます。
以前からずっと「PHPでtypesafeな定数を簡単に書けないか」と思っていたのですが、PHPだと定数(const、define)にオブジェクトを入れること自体が不可能なので、Javaのようなコードで実現するのはムリです。
そこで、定数を返す静的メソッドを用意することで、これに近いことが(一応)できるので晒しておきます。
<?php class Card { private $name; private function __construct($name) { $this->name = $name; } public static function __callStatic($name, $args) { static $objects = null; if (is_null($objects)) { echo "create\n"; $objects = array(); $objects['CLUBS'] = new Card('clubs'); $objects['DIAMONDS'] = new Card('diamonds'); $objects['HEARTS'] = new Card('hearts'); $objects['SPADES'] = new Card('spades'); } if (isset($objects[$name])) { return $objects[$name]; } throw new BadMethodCallException('method not exist'); } public function __toString() { return $this->name; } }
__callStaticを使っているのは、使う側で
Card::CLUBS()
としたいのと、定数ごとのメソッドを用意したくないのが理由です。
実際の使い方は次のような感じ。
<?php function deal(Card $card) { echo $card . "\n"; } deal(Card::CLUBS()); deal(Card::DIAMONDS()); deal(Card::HEARTS()); deal(Card::SPADES()); // エラー // deal(new stdClass());