- array_map: documentation ( source)
- var_dump: documentation ( source)
<?php
$i = 0;
function funsimple() {
global $i;
if (($i++ % 2_000) === 0) {
var_dump($i);
}
funsimple();
}
function fun() {
array_map(function ($str) {
global $i;
if (($i++ % 2_000) === 0) {
var_dump($i);
}
fun();
}, ['x']);
}
$fx = function () use (&$fx, &$i) {
array_map(function ($str) use ($fx, &$i) {
if (($i++ % 2_000) === 0) {
var_dump($i);
}
$fx();
}, ['x']);
};
// funsimple(); // this produces correctly OOM error
// this produces segfault
fun();
// $fx(); // using anonymous function, the behaviour is the same
This script was stopped while abusing our resources