3v4l.org

run code in 300+ PHP versions simultaneously
<?php $values = [1 => 'a', 2 => 'b', 3 => 'c']; $defaultValue = 'd'; function krasivo(array $values, int $number, string $defaultValue = null) { return $values[$number] ?? $defaultValue ?? 'value not found'; } function kal(array $values, int $number, string $defaultValue = null) { if (array_key_exists($number, $values)) { return $values[$number]; } elseif($defaultValue) { return $defaultValue; } else { return 'value not found'; } } echo krasivo($values, 1) . PHP_EOL; echo kal($values, 4) . PHP_EOL;
Output for git.master_jit, git.master, rfc.property-hooks
a value not found

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:
55.79 ms | 405 KiB | 5 Q