3v4l.org

run code in 300+ PHP versions simultaneously
<?php function errorHandler($con) { $body = match($con) { 'id' => 'there was no id', 'name' => 'there was no name', 'age' => 'there was no age', 'age' => 'all good', default => '' }; echo "<h1>$body</h1>"; return (bool) $body; } $Array = [ ['data1' => 1, 'data2' => 0, 'data3' => 1] ]; foreach ($Array as ['data1' => $Id, 'data2' => $name, 'data3' => $age]) { if (!$Id) { if (errorHandler('id')) { break; } } elseif (!$name) { if (errorHandler('name')) { break; } } elseif (!$age) { if (errorHandler('age')) { break; } } else { if (errorHandler('good')) { break; } } echo "UserId $Id, Name = $name, Age = $age<br>"; }
Output for git.master, git.master_jit, rfc.property-hooks
<h1>there was no name</h1>

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:
86.21 ms | 1238 KiB | 4 Q