3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $i = 0; public function method() { return $this->i++; } } $short = [0, 1, 2]; $long = [0, 1, 2]; $foo1 = new Foo(); $foo2 = new Foo(); $long[$foo1->method()] + $long[$foo1->method()] = 1; $short[$foo2->method()] += 1; var_dump($long, $short);

preferences:
55.27 ms | 402 KiB | 5 Q