Do you know how to write the fastest loop?
I just came across an interesting question on Xiaodong Guo's blog: " The difference between $i++ and ++$i in PHP ", and it was interesting enough that I wrote up an answer....
PHP keeps every variable in a symbol table: a global table for the top-level scope plus an active table created for each function call. This post walks through _zend_executor_globals to show how a variable name such as $var is mapped to its zval, and why a function's parameter ends up pointing at a reference instead of a plain copy.
with 0 CommentPHP is weakly typed, yet the Zend Engine is written in strongly typed C. This article shows how PHP represents every variable as a zval struct backed by a zvalue_value union, and how the type field decides which member of the union is read for integers, strings, arrays, objects and resources.
with 0 CommentSAPI is the layer that lets PHP exchange data with the outside world. This article walks through the simplest SAPI of all, the CGI SAPI, field by field through its sapi_module_struct, to show how a SAPI is wired into the Zend Engine.
with 0 CommentIn PHP there are two kinds of functions: zend_internal_function, supplied by an extension or the Zend/PHP kernel in C/C++ and directly executable, and zend_user_function, defined by the user in a PHP script and compiled by the ZE into an opcode array. This article looks at how the two differ at the ZE level, and why zend_internal_function, zend_op_array and zend_function can be safely cast to one another.
with 0 Comment