Answer the question
In order to leave comments, you need to log in
Why are there links in PHP?
I have been actively programming in PHP and JS for a year now, and recently leafing through notebooks from lectures on C ++ every now and then I came across links, as far as I remember this in order for the program to be dynamic or something connected with memory there, in general, there’s nothing I like I remember it can’t do without pointers and links, I decided to take a closer look at the PHP documentation and there is a lot of emphasis on this, why use links and pointers in PHP, how to use it correctly and you can give some example, let’s say how this can help in working with the database or using the example of a controller / models of something everyday for a PHP programmer, it would be very useful for me!!
Answer the question
In order to leave comments, you need to log in
Well, right off the bat:
Modifying elements inside the loop requires a reference:
foreach ($array as &$item) {
$item *= 2;
}
$recursiveClosure = function() use (&$recursiveClosure) {
$recursiveClosure();
};
function foo(&$result)
{
$result = 'result';
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question