3v4l.org

run code in 300+ PHP versions simultaneously
<?php function doIt(string $line): string { $pos = strrpos($line, "&gt;"); if ($pos === false) { return $line; } if ($pos < 4 || substr($line, $pos - 4, 8) === "&gt;&gt;") { return $line; } return substr_replace($line, '<p style="color:#0f0;">', $pos, 0) . "</p>"; } function doItMultiline(string $owo): string { return implode(array_map('doIt', explode(PHP_EOL, $owo)), PHP_EOL); } $line = "awoo&gt;&gt;owo &gt;blyat lolis"; $line2 = "awoo&gt;&gt;owo"; var_dump(doItMultiline($line)); var_dump(doItMultiline($line2));
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /in/3b7gi:11 Stack trace: #0 /in/3b7gi(11): implode(Array, '\n') #1 /in/3b7gi(18): doItMultiline('awoo&gt;&gt;owo...') #2 {main} thrown in /in/3b7gi on line 11
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:
59.48 ms | 401 KiB | 8 Q