3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = <<<JSON { "quiz": { "sport": { "q1": { "question": "Which one is correct team name in NBA?", "options": [ "New York Bulls", "Los Angeles Kings", "Golden State Warriros", "Huston Rocket" ], "answer": "Huston Rocket" } }, "maths": { "q1": { "question": "5 + 7 = ?", "options": [ "10", "11", "12", "13" ], "answer": "12" }, "q2": { "question": "12 - 8 = ?", "options": [ "1", "2", "3", "4" ], "answer": "4" } } } } JSON; $jsonFile = json_decode($json); function getMathQuestions($jsonFile) { foreach($jsonFile as $val) { if(is_object($val)) { getMathQuestions($val); } else { if(is_array($val)) { getMathQuestions($val); } else { echo $val . "<br>"; } } } } echo getMathQuestions($jsonFile);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OMjaA
function name:  (null)
number of ops:  10
compiled vars:  !0 = $json, !1 = $jsonFile
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%0A%22quiz%22%3A+%7B%0A++++%22sport%22%3A+%7B%0A++++++++%22q1%22%3A+%7B%0A++++++++++++%22question%22%3A+%22Which+one+is+correct+team+name+in+NBA%3F%22%2C%0A++++++++++++%22options%22%3A+%5B%0A++++++++++++++++%22New+York+Bulls%22%2C%0A++++++++++++++++%22Los+Angeles+Kings%22%2C%0A++++++++++++++++%22Golden+State+Warriros%22%2C%0A++++++++++++++++%22Huston+Rocket%22%0A++++++++++++%5D%2C%0A++++++++++++%22answer%22%3A+%22Huston+Rocket%22%0A++++++++%7D%0A++++%7D%2C%0A++++%22maths%22%3A+%7B%0A++++++++%22q1%22%3A+%7B%0A++++++++++++%22question%22%3A+%225+%2B+7+%3D+%3F%22%2C%0A++++++++++++%22options%22%3A+%5B%0A++++++++++++++++%2210%22%2C%0A++++++++++++++++%2211%22%2C%0A++++++++++++++++%2212%22%2C%0A++++++++++++++++%2213%22%0A++++++++++++%5D%2C%0A++++++++++++%22answer%22%3A+%2212%22%0A++++++++%7D%2C%0A++++++++%22q2%22%3A+%7B%0A++++++++++++%22question%22%3A+%2212+-+8+%3D+%3F%22%2C%0A++++++++++++%22options%22%3A+%5B%0A++++++++++++++++%221%22%2C%0A++++++++++++++++%222%22%2C%0A++++++++++++++++%223%22%2C%0A++++++++++++++++%224%22%0A++++++++++++%5D%2C%0A++++++++++++%22answer%22%3A+%224%22%0A++++++++%7D%0A++++%7D%0A%7D%0A%7D'
   44     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
   60     5        INIT_FCALL                                               'getmathquestions'
          6        SEND_VAR                                                 !1
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
          9      > RETURN                                                   1

Function getmathquestions:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 18
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/OMjaA
function name:  getMathQuestions
number of ops:  20
compiled vars:  !0 = $jsonFile, !1 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   RECV                                             !0      
   47     1      > FE_RESET_R                                       $2      !0, ->18
          2    > > FE_FETCH_R                                               $2, !1, ->18
   48     3    >   TYPE_CHECK                                  256          !1
          4      > JMPZ                                                     ~3, ->9
   49     5    >   INIT_FCALL_BY_NAME                                       'getMathQuestions'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0          
   48     8      > JMP                                                      ->17
   51     9    >   TYPE_CHECK                                  128          !1
         10      > JMPZ                                                     ~5, ->15
   52    11    >   INIT_FCALL_BY_NAME                                       'getMathQuestions'
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
   51    14      > JMP                                                      ->17
   54    15    >   CONCAT                                           ~7      !1, '%3Cbr%3E'
         16        ECHO                                                     ~7
   47    17    > > JMP                                                      ->2
         18    >   FE_FREE                                                  $2
   58    19      > RETURN                                                   null

End of function getmathquestions

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.45 ms | 1009 KiB | 15 Q