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); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fDhND
function name:  (null)
number of ops:  6
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%22question%22%3A%22chicken%22%2C%22modal%22%3A%22ought+to%22%2C%22probability%22%3A%22high%22%2C%22utilitygain%22%3A%22low%22%2C%22subcondition%22%3A%22Edward%22%2C%22rt%22%3A2975%2C%22response%22%3A%22agree%22%2C%22freeResponse%22%3A%22wvwvwewe%22%7D'
   17     1        INIT_FCALL                                               'parsetrialdata'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
   21     5      > RETURN                                                   1

Function parsetrialdata:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 25
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 25
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/fDhND
function name:  parseTrialData
number of ops:  28
compiled vars:  !0 = $trialData, !1 = $parsedTrialData, !2 = $kv, !3 = $exploded, !4 = $explode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'substr'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 1
          4        SEND_VAL                                                 -1
          5        DO_ICALL                                         $5      
          6        ASSIGN                                                   !0, $5
    7     7        INIT_FCALL                                               'explode'
          8        SEND_VAL                                                 '%2C'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $7      
         11        ASSIGN                                                   !0, $7
   10    12        ASSIGN                                                   !1, <array>
   11    13      > FE_RESET_R                                       $10     !0, ->25
         14    > > FE_FETCH_R                                               $10, !2, ->25
   12    15    >   INIT_DYNAMIC_CALL                                        !4
         16        SEND_VAL_EX                                              '%3A'
         17        SEND_VAR_EX                                              !2
         18        DO_FCALL                                      0  $11     
         19        ASSIGN                                                   !3, $11
   13    20        FETCH_DIM_R                                      ~13     !3, 0
         21        FETCH_DIM_R                                      ~15     !3, 1
         22        ASSIGN_DIM                                               !1, ~13
         23        OP_DATA                                                  ~15
   11    24      > JMP                                                      ->14
         25    >   FE_FREE                                                  $10
   15    26      > RETURN                                                   !1
   16    27*     > RETURN                                                   null

End of function parsetrialdata

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
195.94 ms | 1403 KiB | 18 Q