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 />');
Output for 7.3.0 - 7.3.26, 7.4.0 - 7.4.14, 8.0.0
33052<br />
Process exited with code 139.

preferences:
52.66 ms | 405 KiB | 5 Q