3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Node { public $parent = NULL; public $childs = array(); function __construct(Node $parent=NULL) { if ($parent) { $parent->childs[] = $this; } $this->childs[] = $this; } function __destruct() { $this->childs = NULL; } } define("MAX", 16); while (true) { printf("Memory: %6.2fMB ->", memory_get_usage()/1024/1024); $top = new Node(); for ($i=0 ; $i<MAX ; $i++) { $ci = new Node($top); for ($j=0 ; $j<MAX ; $j++) { $cj = new Node($ci); for ($k=0 ; $k<MAX ; $k++) { $ck = new Node($cj); } } } printf(" %6.2fMB\n", memory_get_usage()/1024/1024); }

Abusive script

This script was stopped while abusing our resources


preferences:
36.39 ms | 402 KiB | 5 Q