3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '{"question":"chicken","modal":"ought to","probability":"high","utilitygain":"low","subcondition":"Edward","rt":2975,"response":"agree","freeResponse":"wvwvwewe"}'; function parseTrialData ($trialData) { $trialData = substr($trialData, 1, -1); // get rid of leading '{' and trailing '}' $trialData = explode(',', $trialData); // 'explode' is PHP for 'split' // i.e., separate the string into an array of strings of form 'key:value' $parsedTrialData = array(); foreach ($trialData as $kv) { $exploded = $explode(':', $kv); $parsedTrialData[$exploded[0]] = $exploded[1]; } return $parsedTrialData; } echo parseTrialData($str); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $explode in /in/fDhND on line 12 Fatal error: Uncaught Error: Value of type null is not callable in /in/fDhND:12 Stack trace: #0 /in/fDhND(17): parseTrialData(Array) #1 {main} thrown in /in/fDhND on line 12
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:
47.9 ms | 401 KiB | 8 Q