3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = "hello : 6\ngoodbye : 7\nfoo : bar\n"; $lines = explode("\n", trim($data)); $tuples = array_map( function($line) { $splitLine = array_map('trim', explode(':', $line)); return array( trim(substr($line, 0, strpos(':'))), trim(substr($line, strpos(':'))) ); }, $lines ); $output = array_combine( array_map(function($t) { return $t[0]; }, $tuples), array_map(function($t) { return $t[1]; }, $tuples) ); var_dump($output);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: strpos() expects at least 2 arguments, 1 given in /in/LdN5V:14 Stack trace: #0 /in/LdN5V(14): strpos(':') #1 [internal function]: {closure}('hello : 6') #2 /in/LdN5V(7): array_map(Object(Closure), Array) #3 {main} thrown in /in/LdN5V on line 14
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:
75.51 ms | 401 KiB | 8 Q