Skip to content
Advertisement

Tag: php-internals

Where is PHP echo implemented in the source?

You can lookup built-in functions by searching for e.g. PHPAPI(stream_copy_to_stream) and find the implementation in ext/standard/streamsfuncs.c. How to do that for a language construct like echo? I found it is associated with T_ECHO in Zend/zend_language_parser.y but couldn’t trace how it works from there. Where does Zend Engine implement echo functionality? Answer Given this example program: We can obtain the opcodes

What was PHP’s “o” serialization format for?

The list of backwards-incompatible changes for PHP 7.4 contain the following note: Serialization The o serialization format has been removed. As it is never produced by PHP, this may only break unserialization of manually crafted strings. (Note that this is referring to a little-o, not the big-O format which is used for object serialization.) It seems this was never generated

What is the actual memory cost of storing an integer?

lets say I just do this So I store 10 integers in an array. If the integer is a 32b one, the memory cost should be 40 bytes. Problem is, I didn’t tell php that it is an integer so it either has to store it as something else? (js likes to make doubles for example) or keep extra data

Advertisement