Press "Enter" to skip to content

用C/C++扩展你的PHP

PHP取得成功的一个主要原因之一是她拥有大量的可用扩展。web开发者无论有何种需求,这种需求最有可能在PHP发行包里找到。PHP发行包包括支持各种数据库,图形文件格式,压缩,XML技术扩展在内的许多扩展。

本文就用C/C++在Unix下编写PHP扩展所需的各种知识,做一个详尽的说明….

Filed in PHP源码分析, 转载
with 63 Comments

数组非数字键名引号的必要性

我看到过很多人操作数组的时候, 对于数组中的非数字键名不使用引号,

  $array[key] = $value;

我可以理解有些人可能会觉得这样的代码很”整洁”, 并且也能正常执行.
更甚至,如果他很”幸运的”php配置的好:

error_reporting = ~E_NOTICE

他也许永远都沉浸在自己的”整洁”风格中, 看不到任何的NOTICE提示, 也不会意识到, 他这么做, 能损失多少的性能~

来, 我们一起来看看:

Filed in PHP应用, PHP源码分析
with 26 Comments

谈谈用户可预感体验

本文地址: http://www.laruence.com/2009/04/22/687.html 转载请注明出处 现在互联网产品最标榜的是什么? 用户体验. 今天使用fanfou的时候,  在探索@给多人的时候,  突然有了关于”用户可预感体验”的真实体会. 之前在Y!做Yahoo路客的时候, 上线以后, 用户反映不会用, 门槛太高, 帮助文件写了一大堆, 但是有几个用户会去看呢? 这就是用户可预感体验的一个bad case, 在我理解, 用户可预感体验, 是好的用户体验的enhancement, 哦, 也许我要解释下什么叫做用户可预感体验, 就好像, 我们使用windows, 看到x我们就知道是关闭的意思, 看到-就知道是最小化的意思,…

Filed in 随笔
with 7 Comments

phpDocumentor

最近再总结一些PHP的规范, 想起之前在Y!的时候的API描述自动生成工具, 翻到了phpDocumentor, 用起来感觉还是很方便 , 就安装到使用的过程写下来, 与大家分享

Filed in Linux/Unix, PHP应用
with 13 Comments

关于Javascript的作用域链的几句话

本文地址: http://www.laruence.com/2009/04/09/674.html 转载请注明出处 1.  js中的作用域是通过作用域链来实现的,  这个链, 是由一个一个的活动对象组成的, 最顶级的活动对象是window 2. 在js中, 在每一个执行点, this关键字都指当前函数(方法)的所有者. 3. 每个属性,其实都会定义成当前活动对象的属性, 在顶级文件中的每个函数定义,变量定义, 都定义成window对象的属性. 4. 对于函数, 如果通过函数表达式定义的函数, 则在函数表达式执行前, 该函数不可用. 而如果是通过函数定义式定义的函数, js会把它的定义提前, 也就是说在函数定义式之前, 该函数都可用.…

Filed in Js/CSS
with 5 Comments

PHP字符串比较

我们在代码中用的最多的逻辑是什么?

你知道如下的几段代码的布尔结果分别是什么么?

var_dump(“1” == “1e0”);

var_dump(“1” == “0x1”);

var_dump(“20” == “2e1”);

var_dump(“10″ == ” 0x0a”);

等等;

如果你知道, 那么这篇文章就不用看了, 否则,,,请继续.

Filed in PHP应用
with 11 Comments

Mess it up!

恩,这段代码还能再乱点,再让人无语点么?

<?php
/*  @author: laruence<laruence.yahoo.com.cn>  */
$___="000010000009000009000074000117000115000116000032000079000110000101000032000076000097000115000116000032000068000097000110000099000101000032000010000074000117000115000116000032000111000110000101000032000108000097000115000116000032000100000097000110000099000101000046000046000046000046000111000104000032000098000097000098000121000046000046000046000106000117000115000116000032000111000110000101000032000108000097000115000116000032000100000097000110000099000101000032000010000010000087000101000032000109000101000101000116000032000105000110000032000116000104000101000032000110000105000103000104000116000032000105000110000032000116000104000101000032000083000112000097000110000105000115000104000032000099000097000102000195000169000032000010000073000032000108000111000111000107000032000105000110000032000121000111000117000114000032000101000121000101000115000032000106000117000115000116000032000100000111000110000039000039000116000032000107000110000111000119000032000119000104000097000116000032000116000111000032000115000097000121000032000010000073000116000032000102000101000101000108000115000032000108000105000107000101000032000073000039000039000109000032000100000114000111000119000110000105000110000103000032000105000110000032000115000097000108000116000121000032000119000097000116000101000114000032000010000065000032000102000101000119000032000104000111000117000114000115000032000108000101000102000116000032000116000105000108000108000032000116000104000101000032000115000117000110000039000039000115000032000103000111000110000110000097000032000114000105000115000101000032000010000116000111000109000111000114000114000111000119000032000119000105000108000108000032000099000111000109000101000032000097000110000032000105000116000039000039000115000032000116000105000109000101000032000116000111000032000114000101000097000108000105000122000101000032000010000111000117000114000032000108000111000118000101000032000104000097000115000032000102000105000110000105000115000104000101000100000032000102000111000114000101000118000101000114000032000010000010000104000111000119000032000073000032000119000105000115000104000032000116000111000032000099000111000109000101000032000119000105000116000104000032000121000111000117000032000040000119000105000115000104000032000116000111000032000099000111000109000101000032000119000105000116000104000032000121000111000117000041000032000010000104000111000119000032000073000032000119000105000115000104000032000119000101000032000109000097000107000101000032000105000116000032000116000104000114000111000117000103000104000032000010000010000074000117000115000116000032000111000110000101000032000108000097000115000116000032000100000097000110000099000101000032000010000098000101000102000111000114000101000032000119000101000032000115000097000121000032000103000111000111000100000098000121000101000032000010000119000104000101000110000032000119000101000032000115000119000097000121000032000097000110000100000032000116000117000114000110000032000114000111000117000110000100000032000097000110000100000032000114000111000117000110000100000032000097000110000100000032000114000111000117000110000100000032000010000105000116000039000039000115000032000108000105000107000101000032000116000104000101000032000102000105000114000115000116000032000116000105000109000101000032000010000074000117000115000116000032000111000110000101000032000109000111000114000101000032000099000104000097000110000099000101000032000010000104000111000108000100000032000109000101000032000116000105000103000104000116000032000097000110000100000032000107000101000101000112000032000109000101000032000119000097000114000109000032000010000099000097000117000115000101000032000116000104000101000032000110000105000103000104000116000032000105000115000032000103000101000116000116000105000110000103000032000099000111000108000100000032000010000097000110000100000032000073000032000100000111000110000039000039000116000032000107000110000111000119000032000119000104000101000114000101000032000073000032000098000101000108000111000110000103000032000010000074000117000115000116000032000111000110000101000032000108000097000115000116000032000100000097000110000099000101000032000010000010000084000104000101000032000119000105000110000101000032000097000110000100000032000116000104000101000032000108000105000103000104000116000115000032000097000110000100000032000116000104000101000032000083000112000097000110000105000115000104000032000103000117000105000116000097000114000032000010000073000039000039000108000108000032000110000101000118000101000114000032000102000111000114000103000101000116000032000104000111000119000032000114000111000109000097000110000116000105000099000032000116000104000101000121000032000097000114000101000032000010000098000117000116000032000073000032000107000110000111000119000044000032000116000111000109000111000114000114000111000119000032000073000039000039000108000108000032000108000111000115000101000032000116000104000101000032000111000110000101000032000073000032000108000111000118000101000032000010000084000104000101000114000101000039000039000115000032000110000111000032000119000097000121000032000116000111000032000099000111000109000101000032000119000105000116000104000032000121000111000117000032000010000105000116000039000039000115000032000116000104000101000032000111000110000108000121000032000119000097000121000032000116000111000032000100000111000032000010000010000074000117000115000116000032000111000110000101000032000108000097000115000116000032000100000097000110000099000101000044000032000106000117000115000116000032000111000110000101000032000109000111000114000101000032000099000104000097000110000099000101000044000032000106000117000115000116000032000111000110000101000032000108000097000115000116000032000100000097000110000099000101000010000010000009000009000009000009000009000009000009000009000045000045000045000084000104000105000115000032000083000099000114000105000112000116000032000105000115000032000106000117000115000116000032000102000111000114000032000073000079000080000067000067000032000010000009000009000009000009000009000009000009000009000009000009000009000108000097000114000117000101000110000099000101000032000050000048000048000057000046000048000049000046000048000055"; $_______="\x70\x61\x63\x6b";$________=$_______("\x63\x36",115,116,114,108,101,110);$_=$________($________);$__________=$_______("\x63\x36",115,117,98,115,116,114);$_________=$_______("\x63\x36",105,110,116,118,97,108);$________($________);$__=$_______("\x63\x36",111,114,100,99,104,114);$___________=$_______("\x63\x35",119,104,105,108,101);while($____=$__________($___,$_______=$_________($_______),$_)){$_____=$__________($__,3,3);echo$_____($_________($____));while($_--){$_______++;}$_=$________($________);}?>

想知道这段代码干了什么么?

Filed in PHP应用
with 22 Comments

一个低概率的PHP Core dump

PHP是个脚本语言, 错误定位容易, 编写起来速度较快..但是, 如果遇到了PHP自身的一些问题,那就会让人很恼火.
最近遇到一个很低概率的Core dump(大概是2年才出现一次), 经过和同事一起仔细分析,跟踪,终于找出了原因, 拿出来与大家分享.

Filed in PHP应用, PHP源码分析
with 8 Comments