3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrayData = new class implements \ArrayAccess { public function offsetExists($offset) { echo "offsetExists\n"; } public function offsetGet($offset) { echo "offsetGet\n"; } public function offsetSet($offset, $value) { } public function offsetUnset($offset) { } }; echo "arrayData - isset:\n"; isset($arrayData['foo']) ? NULL : NULL; echo "arrayData - null coalescing operator:\n"; $arrayData['foo'] ?? NULL; $fixedData = new class extends \SplFixedArray { public function offsetExists($offset) { echo "offsetExists\n"; } public function offsetGet($offset) { echo "offsetGet\n"; } public function offsetSet($offset, $value) { } public function offsetUnset($offset) { } }; echo "fixedData - isset:\n"; isset($fixedData['foo']) ? NULL : NULL; echo "fixedData - null coalescing operator:\n"; $fixedData['foo'] ?? NULL;
Output for git.master, git.master_jit
Deprecated: Return type of ArrayAccess@anonymous::offsetExists($offset) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/BudKa on line 5 Deprecated: Return type of ArrayAccess@anonymous::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/BudKa on line 11 Deprecated: Return type of ArrayAccess@anonymous::offsetSet($offset, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/BudKa on line 17 Deprecated: Return type of ArrayAccess@anonymous::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/BudKa on line 22 arrayData - isset: offsetExists arrayData - null coalescing operator: offsetExists Deprecated: Return type of SplFixedArray@anonymous::offsetExists($offset) should either be compatible with SplFixedArray::offsetExists($index): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/BudKa on line 34 Deprecated: Return type of SplFixedArray@anonymous::offsetGet($offset) should either be compatible with SplFixedArray::offsetGet($index): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/BudKa on line 40 Deprecated: Return type of SplFixedArray@anonymous::offsetSet($offset, $value) should either be compatible with SplFixedArray::offsetSet($index, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/BudKa on line 46 Deprecated: Return type of SplFixedArray@anonymous::offsetUnset($offset) should either be compatible with SplFixedArray::offsetUnset($index): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/BudKa on line 51 fixedData - isset: offsetExists fixedData - null coalescing operator: offsetExists

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:
15.29 ms | 418 KiB | 5 Q