3v4l.org

run code in 300+ PHP versions simultaneously
<?php $obj1 = [['main' => 10, 'fallback' => 5]]; $obj2 = [['main' => null, 'fallback' => 5]]; $obj3 = [['main' => null, 'fallback' => null]]; $obj4 = [[]]; $obj5 = [['fallback' => 5]]; $obj6 = [['main' => 10]]; function doStuff($obj) { return $obj[0]['main'] ?? $obj[0]['fallback'] ?? 0; } var_dump(doStuff($obj1)); var_dump(doStuff($obj2)); var_dump(doStuff($obj3)); var_dump(doStuff($obj4)); var_dump(doStuff($obj5)); var_dump(doStuff($obj6));
Output for git.master, git.master_jit, rfc.property-hooks
int(10) int(5) int(0) int(0) int(5) int(10)

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