php-internals
What’s the difference between “extension” and “zend_extension” in php.ini?
Zend_extentions are extensions that are built into the Zend engine itself. The engine parses, interprets and executes PHP script. Changing the engine changes the way that PHP works. The included diagram will describe the main difference between an extension and a zend_extension. Both types of extensions share lots of functionality. The difference between both types … Read more
What is the difference between while(true) and for(;;) in PHP?
Ok, so first off, let me say this: Use while(true), as it gives the most semantic meaning. You need to parse for (;;) as it’s not something you see often. With that said, let’s analyze: Opcodes The code while(true) { break; } echo “hi!”; Compiles down to the opcodes: 0: JMPZ(true, 3) 1: BRK(1, 3) … Read more
Parentheses altering semantics of function call result
This behavior could be classified as bug, so you should definitely not rely on it. The (simplified) conditions for the message not to be thrown on a function call are as follows (see the definition of the opcode ZEND_SEND_VAR_NO_REF): the argument is not a function call (or if it is, it returns by reference), and … Read more
What does “zend_mm_heap corrupted” mean
After much trial and error, I found that if I increase the output_buffering value in the php.ini file, this error goes away
How does PHP ‘foreach’ actually work?
foreach supports iteration over three different kinds of values: Arrays Normal objects Traversable objects In the following, I will try to explain precisely how iteration works in different cases. By far the simplest case is Traversable objects, as for these foreach is essentially only syntax sugar for code along these lines: foreach ($it as $k … Read more