Opcodes列表
with 18 Commentsforeach是PHP中很常用的一个用作数组循环的控制语句。
因为它的方便和易用,自然也就在后端隐藏着很复杂的具体实现方式:(对用户透明)
今天,我们就来一起分析分析,foreach是如何实现数组(对象)的遍历的。
本节内容涉及到较多编译原理(lex and yacc)的知识,所以如果您觉得看不太懂,可以先找相关的资料看看。
今天研究PHP注册POST/GET大变量的时候,看到了关于这块的一些东西,跟踪了半天,,先记录下来,免得以后再如此麻烦的跟踪
处理器注册:
[mod_php5.c, mod_php5模块初始化] php_init_handler(server_rec *s, pool *p) ->[main/SAPI.c]sapi_startup(&apache_sapi_module) ->[main/SAPI.c] sapi_globals_ctor(&sapi_globals) ->[main/php_content_types.c]php_setup_sapi_content_types(TSRMLS_C) ->[main/php_content_types.c php_post_entries如下]sapi_register_post_entries(php_post_entries TSRMLS_CC) ->[main/SAPI.c]sapi_register_post_entry(p TSRMLS_CC)
.....
with 19 Comments 主要探讨了PHP的大变量的生成过程。另外如果你注意到, 当在表单中提交的input的name中如果有点号的时候, 在PHP中会自动把点号处理成下划线。并且你很想知道这是为什么,在什么时候发生的? 呵呵,本文也就这个问题做了回答。
首先明确一个问题,PHP的变量名中是不能包含点号的。 但是为了处理表单中的点号命名,PHP就会自动把点号(.)转换成下划线(_) ..........
PHP5.3 α2 已经放出1个多月了, 最近一直都忙一些私人的事情, 今天终于有点时间.
赶紧下来试用, apache2.x + php5.3 alpha2
changes:
- Namespaces (documentation maybe out dated)
- Late static binding and __callStatic
- Lambda functions and closures
- Addition of the intl, phar (phar is scheduled for some more work a head of alpha2), fileinfo and sqlite3 extensions
- Optional cyclic garbage collection
- Optional support for the MySQLnd replacement driver for libmysql
- Windows older than Windows 2000 (Windows 98, NT4, etc.) are not supported anymore (details)
- New syntax features like NOWDOC, limited GOTO, ternary short cut "?:"
Filed in PHP应用
with 9 Comments
在前面的文章中我已经介绍了PHP的变量的内部表示(深入理解PHP原理之变量(Variables inside PHP)),以及PHP中作用域的实现机制(深入理解PHP原理之变量作用域(Scope inside PHP))。这节我们就接着前面的文章,继续介绍PHP中变量分离和引用的概念:
with 76 Comments