3v4l.org

run code in 300+ PHP versions simultaneously
<?php function parseMT4Answer($data){ if ($data[0][0] === 'error') { $result['success'] =FALSE; $result['reason'] ='connection error'; return $result; } $result = array(); foreach ($data as $v){ if ($v[0]==='result' && $v[1]==='1') { $result['success'] =TRUE; }else{ if ($v[0]==='reason'){ $result['success']=FALSE; $result['reason']=$v[1]; }else{ $result[$v[0]]=$v[1]; } } } return $result; } $d = array(); echo json_encode(parseMT4Answer($d)); var_dump(parseMT4Answer($d));
Output for git.master, git.master_jit
Warning: Undefined array key 0 in /in/ojBob on line 4 Warning: Trying to access array offset on value of type null in /in/ojBob on line 4 [] Warning: Undefined array key 0 in /in/ojBob on line 4 Warning: Trying to access array offset on value of type null in /in/ojBob on line 4 array(0) { }
Output for rfc.property-hooks
Warning: Undefined array key 0 in /in/ojBob on line 4 Warning: Trying to access array offset on null in /in/ojBob on line 4 [] Warning: Undefined array key 0 in /in/ojBob on line 4 Warning: Trying to access array offset on null in /in/ojBob on line 4 array(0) { }

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:
40.39 ms | 401 KiB | 8 Q