3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyBitmask { const POS_1 = 1; // const POS_2 = 2; // reserved/undefined // const POS_3 = 3; // reserved/undefined const POS_4 = 4; private $b = 0x0000; function setChecked($pos) { if (in_array($pos, (new ReflectionClass($this))->getConstants())) { $this->set($pos); } return $this; } function set($pos) { $this->b |= 1 << ($pos - 1); return $this; } } $b = new MyBitmask(); var_dump($b->setChecked(2)); var_dump($b->set(2));
Output for git.master, git.master_jit, rfc.property-hooks
object(MyBitmask)#1 (1) { ["b":"MyBitmask":private]=> int(0) } object(MyBitmask)#1 (1) { ["b":"MyBitmask":private]=> int(2) }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
60.64 ms | 401 KiB | 8 Q