3v4l.org

run code in 300+ PHP versions simultaneously
<?php class LinkedList { private $_length = 0; private $_head; private $_tail; public function add($data) { $node = (object) array('data' => $data, 'next' => null); if ($this->_length == 0) { $this->_head = $node; $this->_tail = $node; } else { $this->_tail->next = $node; $this->_tail = $node; } $this->_length++; } } $a = new LinkedList(); $startMemory = memory_get_usage(); for ($i = 1; $i <= 78860; $i++) { $a->add($i); } $endMemory = memory_get_usage(); print((int) (($endMemory - $startMemory) / 1024) . '<br />');

preferences:
23.22 ms | 404 KiB | 5 Q