- var_dump: documentation ( source)
- str_repeat: documentation ( source)
- register_shutdown_function: documentation ( source)
- ini_set: documentation ( source)
- array_fill: documentation ( source)
- define: documentation ( source)
<?php
ini_set('memory_limit', '64M');
define('N', 100);
register_shutdown_function(function() {
global $max;
ini_set('memory_limit', '256M');
$y = [];
for ($i = 0; $i < N; $i++)
{
var_dump($i);
$y[] = str_repeat('asdf', $max);
}
var_dump('end');
});
$x = array_fill(0, N, '');
$max = 0;
$i = 0;
while (true)
{
$x[$i] .= 'asdf';
if (++$i >= N)
{
$i = 0;
$max++;
}
}
This script was stopped while abusing our resources