3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Factory { private $Data = []; public function set($index, $data) { $this->Data[$index] = $data; } public function get($index) { return $this->Data[$index]; } } session_start(); $f = new Factory(); $f->set('Cookies', $_SESSION); $f->set('Check-Cookie', function() use ($f) { return $f->get('Cookies')['logged'] ? [true, $f->get('Cookies')['logged']] : [false, null]; }); $cookieArr = is_callable($f->get('Check-Cookie')) ? call_user_func($f->get('Check-Cookie')) : []; echo $cookieArr[0] ? $cookieArr[1] : 'Logged is not set';
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key "logged" in /in/k5mk9 on line 18 Logged is not set

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:
44.02 ms | 401 KiB | 8 Q