Questions tagged [php-internals]

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

PHP Internals

Tag purpose

The purpose of the tag is to indicate a question about the internals of PHP. Possible questions could be about how references counting or copy on write. E.g. When you want to know what happens under the hood while doing things in PHP. It can also be applied to questions in the tag that deal with extending PHP at the core. This tag should also be used for any questions about the Zend Engine powering PHP.


External Links

269 questions
12
votes
1 answer

How does PHP assign and free memory for variables?

I was wondering when does PHP free the memory which is used for a variables for example function foo(){ $foo = 'data'; return $foo; // <- is the memory space for `$foo` emptied at this point? } is it slower than: function foo(){ return…
Alex
  • 66,732
  • 177
  • 439
  • 641
12
votes
1 answer

Confusion about PHP 7 refcount

Lynn
  • 665
  • 8
  • 25
11
votes
2 answers

Writing PHP opcode and have it executed. How to do?

How can I write PHP opcode, save it in a file and make the Zend Engine execute it? Any method or hack is welcome, as long as it does the trick.
Raffael
  • 19,547
  • 15
  • 82
  • 160
11
votes
1 answer

zend custom module

I am trying to build my own zend module (.so) We have multiple functionality that can be done in our own module which will improve our performance on a high traffic website (50k+ visits a day). These are simple module but I was wondering is the…
Erin Tucker
  • 3,274
  • 2
  • 15
  • 22
11
votes
2 answers

Why is in_array strict mode on integers slower than non-strict mode?

I always thought that in_array strict mode will be faster or at least the same speed as non-strict mode. But after some benchmarks I noticed there is a huge difference in execution time between them while searching for integers. The string and array…
Tom
  • 369
  • 2
  • 14
11
votes
1 answer

C PHP Extension object persistance

I've developed a PHP5 client extension for a server application i wrote, and so far it's working quite well, but it doesn't support persistent connections yet. Since this is something i want to implement before releasing the first stable version, i…
Simone Margaritelli
  • 4,584
  • 10
  • 45
  • 70
10
votes
3 answers

What are the functions PHP which are said not to be "binary safe"? To which libraries these "non-binary safe" functions hand off the strings? And why?

I'm using Windows 10 Home Single Language Edition which is a 64-bit Operating System on my machine. I've installed the most latest version of XAMPP which has installed PHP 7.2.7 on my machine. I'm asking this question based on the excerpt taken from…
PHPLover
  • 1
  • 51
  • 158
  • 311
10
votes
2 answers

Does PHP read functions before they are called?

I declare 100 functions, but I don't actually call any of them. Will having so many functions defined affect loading time? Does PHP process these functions before they are called?
wordpress user
  • 548
  • 7
  • 24
9
votes
0 answers

PHP Zend Engine Extension static method call

I am writing a PHP extension. From the C code I try to invoke a static method in PHP code. The PHP-method looks like this: The call in C looks like this: if(…
9
votes
1 answer

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…
HappyDog
  • 1,230
  • 1
  • 18
  • 45
9
votes
1 answer

PHP's MySQL Cursor implementations and how they manage memory

How do the different MySQL Cursors within PHP manage memory? What I mean is, when I make a MySQL query that retrieves a large result set, and get the MySQL resource back, how much of the data that the query retrieved is stored in local memory, and…
Jim Rubenstein
  • 6,836
  • 4
  • 36
  • 54
9
votes
3 answers

how to check php function source code using eclipse

I'm curious on how certain php functions are implemented internally. e.g. array_values(). So in eclipse, I control click on the function name, which took me to a page that contain function prototype definition, but contains no internal source code.…
Thor
  • 9,638
  • 15
  • 62
  • 137
9
votes
1 answer

What is the reasoning behind the refusal of PHP to accept the return types in this simple situation?

In PHP 7.1.4, using strict typing, I have a simple object oriented setup involving some interfaces, and some classes implementing those interfaces. Below example, as you would expect, works fine. declare(strict_types=1); interface Loginable { …
Istvan Dupai
  • 113
  • 1
  • 7
9
votes
2 answers

Is there ever a need to use ampersand in front of an object?

Since objects are passed by reference by default now, is there maybe some special case when &$obj would make sense?
LDusan
  • 205
  • 2
  • 8
9
votes
1 answer

Writing a C++ extension for PHP 5.4, example code is obsolete

I am trying to write an extension for php5.4 which basically wraps a very simple class in CPP. This is for education purposes. I find the way to do it in php5.4 has changed from php5.3 Where do I find the documentation on how to do it? Or even…
Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278
1 2
3
17 18