3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (Term::create('oni')->in(['cheese', 'tomato', 'onion', 'pepperoni'])) { echo '"oni" is available in the given ingredients'.PHP_EOL; } else { echo '"oni" is NOT available in the given ingredients'.PHP_EOL; } if (Term::create('oni')->in('pepperoni')) { echo '"oni" is available in the given ingredient'.PHP_EOL; } else { echo '"oni" is NOT available in the given ingredient'.PHP_EOL; } // Pretend the following isn't here class Term { public $value; public function __construct($value) { $this->value = $value; } public static function create($value) { return new self($value); } public function in($search) { return array_reduce((array) $search, function ($carry, $item) { return $carry ?: (bool) mb_substr_count($item, $this->value); }); } public function notIn($search) { return !$this->in($array); } public function __toString() { return $this->value; } }
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Class "Term" not found in /in/ZfCBH:4 Stack trace: #0 {main} thrown in /in/ZfCBH on line 4
Process exited with code 255.

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:
52.32 ms | 1565 KiB | 4 Q