3v4l.org

run code in 300+ PHP versions simultaneously
<?php $replacer = function ($scheme, $url) { return preg_replace('/^https?/', $scheme, $url); }; $originals = [ 'http://fake.url', 'https://fake.url/ssl', ]; $schemes = ['http', 'https']; foreach ($schemes as $iteration => $scheme) { foreach ($originals as $urlToReplace) { echo "\n#$iteration"; echo "\nScheme: $scheme"; echo "\nOriginal URL: $urlToReplace"; $newUrl = replacer($scheme, $urlToReplace); echo "\New URL: $newUrl"; } }
Output for git.master, git.master_jit, rfc.property-hooks
#0 Scheme: http Original URL: http://fake.url Fatal error: Uncaught Error: Call to undefined function replacer() in /in/IKSbM:18 Stack trace: #0 {main} thrown in /in/IKSbM on line 18
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:
50.77 ms | 401 KiB | 8 Q