PHP性能提升的技巧 (3)
<?php
$a['b']['c'] = array();
// slow 2 extra hash lookups per access
for ( $i = 0; $i < 5; ++ $i)
$a['b']['c'][ $i] = $i;
// much faster reference based approach
$ref =& $a['b']['c'];
for ( $i = 0; $i < 5; ++ $i)
$ref[ $i] = $i;
?>
QUOTE:
// PHP CODE Highliting for CU by dZ902
<?php
$a = 'large string';
// memory intensive approach
function a( $str)
{
return $str.'something';
}
// more efficient solution
function a(& $str)
{
$str .= 'something';
}
?>
==============================================
[size=+2]参考资料
http://ilia.ws
Ilia 的个人网站,Blog,他参与的开发以及出版的一些稿物链接等等。
http://ez.no
eZ components 官方网站,eZ comp 是针对 PHP5 的开源通用库,以效率为己任,Ilia 也参与了开发。
http://phparch.com
php|architect,不错的 php 出版商/培训组织。买不起或者买不到的话,网上可以下到很多经典的盗版。

[
1] [
2]
[3] 