Skip to main content

Questions tagged [php-internals]

How the PHP programming language works underneath, and questions about the underlying C code.

2282 votes
7 answers
459k views

How does PHP 'foreach' actually work?

Let me prefix this by saying that I know what foreach is, does and how to use it. This question concerns how it works under the bonnet, and I don't want any answers along the lines of "this is how you ...
DaveRandom's user avatar
  • 88.4k
133 votes
41 answers
187k views

What does "zend_mm_heap corrupted" mean

All of the sudden I've been having problems with my application that I've never had before. I decided to check the Apache's error log, and I found an error message saying "zend_mm_heap corrupted". ...
bkulyk's user avatar
  • 1,694
52 votes
2 answers
3k views

Parentheses altering semantics of function call result

It was noted in another question that wrapping the result of a PHP function call in parentheses can somehow convert the result into a fully-fledged expression, such that the following works: <?php ...
Lightness Races in Orbit's user avatar
46 votes
2 answers
22k views

What's the difference between "extension" and "zend_extension" in php.ini?

When I installed Xdebug through pecl, it added the following line to my php.ini file. extension="xdebug.so" and everything I used worked. Until today. Today I was having trouble setting up Xdebug ...
Alana Storm's user avatar
44 votes
1 answer
3k views

What is the difference between while(true) and for(;;) in PHP?

Is there any difference in PHP between while(true) and for(;;) besides syntax and readability?
Alastair's user avatar
  • 1,780
43 votes
6 answers
6k views

Why don't PHP attributes allow functions?

I'm pretty new to PHP, but I've been programming in similar languages for years. I was flummoxed by the following: class Foo { public $path = array( realpath(".") ); } It produced a ...
Schwern's user avatar
  • 161k
31 votes
4 answers
7k views

Where can I learn about PHP internals? [closed]

What are good resources to start learning the internals of PHP and the Zend Engine?
Adam Ramadhan's user avatar
29 votes
1 answer
5k views

Where's the php-src/PHP-Internals Main Entry Point

What function or bit of code serves as the main entry point for executing/interpreting a PHP program in the source of PHP itself? Based on things I've googled or read in books, I know that PHP is ...
Alana Storm's user avatar
29 votes
0 answers
1k views

Pre-compiling PHP files [closed]

As a learning exercise, I'm trying to save the compiled state of a PHP file in order to execute it at a later time without having to go through zend_compile_file again. The first thing I did was ...
MyUsername112358's user avatar
28 votes
1 answer
992 views

Why can't you inherit from a not-yet-defined class which inherits from a not-yet-defined class?

I research about class compilation, it's sequence, and logic. If I declare a class before a simple parent: class First extends Second{} class Second{} This will work OK. See live example across ...
sergio's user avatar
  • 5,210
27 votes
5 answers
7k views

Detecting whether a PHP variable is a reference / referenced

Is there a way in PHP to determine whether a given variable is a reference to another variable and / or referenced by another variable? I appreciate that it might not be possible to separate ...
borrible's user avatar
  • 17.3k
26 votes
5 answers
10k views

How are associative arrays implemented in PHP?

Can someone explain how PHP implements associative arrays? What underlying data structure does PHP use? Does PHP hash the key and store it in some kind of hash map? I am curious because I was ...
user avatar
25 votes
3 answers
5k views

In which order are objects destructed in PHP?

What is the exact order of object deconstruction? From testing, I have an idea: FIFO for the current scope. class test1 { public function __destruct() { echo "test1\n"; } ...
bob-the-destroyer's user avatar
25 votes
1 answer
1k views

Get PHP Opcodes Dynamically at Runtime

I want to build a PHP extension that can dynamically inspect every opcode generated from a PHP file and do some checking on that. I came across several websites and found out a couple of functions ...
ebudi's user avatar
  • 287
22 votes
4 answers
4k views

How does PHP memory actually work

I've always heard and searched for new php 'good writing practice', for example: It's better (for performance) to check if array key exists than search in array, but also it seems better for memory ...
George G's user avatar
  • 7,639

15 30 50 per page
1
2 3 4 5
18