3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string='[ { "id": "7ac648ce-18aa-11e9-b673-005056be36b2", "answer": "1", "id_question": "39", "pi": "very good", "ca": null, "pic": null, "new_deadline": null, "reason": null, "notes": null, "deadline": null }, { "id": "8653ef3d-18aa-11e9-b673-005056be36b2", "answer": "3", "id_question": "40", "pi": "no problem", "ca": null, "pic": null, "new_deadline": null, "reason": null, "notes": null, "deadline": null } ]'; $string2='[ { "id": "38", "question": "Kebersihan Meja Counter dan Meja Fincoy ", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" }, { "id": "39", "question": "Seragam Sales Counter / Salesman* ", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" }, { "id": "40", "question": "Kerapihan Sales Counter", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" }, { "id": "42", "question": "Sales Guide", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" }, { "id": "43", "question": "Product Card", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" }, { "id": "44", "question": "Ketersediaan Buku Tamu", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" }, { "id": "45", "question": "Ketersediaan Price List", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" }, { "id": "46", "question": "Ketersedian Rak Brosur ", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" }, { "id": "47", "question": "Ketersediaan Flyer*/brosur\t", "type": "NON DOS", "last_root": "1", "exist_good": "1", "exist_not_good": "0", "not_exist": "1", "n_a": "0" } ]'; $json = json_decode($string, true); $json2 = json_decode($string2, true); $array0=array(); foreach($json as $key) { $array0[$key['id_question']]=$key; } $array1=array(); foreach($json2 as $key) { $array1[$key['id']]=$key['question']; if(!isset($array0[$key['id']])) { $row=array(); $row["id"]=$key['question']; $row["id_question"]=$key['id']; $row["answer"]=null; $row["pi"]=null; $row["ca"]=null; $row["pic"]=null; $row["new_deadline"]=null; $row["reason"]=null; $row["notes"]=null; $row["deadline"]=null; $array0[]=$row; } } $array2=array(); foreach($array0 as $key) { if(isset($array1[trim($key['id_question'])])){ $key['question']=$array1[$key['id_question']]; } $key['id']=$key['id_question']; unset($key['id_question']); $array2[]=$key; } // echo // print_r($array2); // convert to json $json=json_encode($array2); print_r($json); die;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 19
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 57
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 57
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 56
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 56
Branch analysis from position: 57
2 jumps found. (Code = 77) Position 1 = 60, Position 2 = 76
Branch analysis from position: 60
2 jumps found. (Code = 78) Position 1 = 61, Position 2 = 76
Branch analysis from position: 61
2 jumps found. (Code = 43) Position 1 = 65, Position 2 = 69
Branch analysis from position: 65
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
Branch analysis from position: 69
Branch analysis from position: 76
1 jumps found. (Code = 61) Position 1 = -2
Branch analysis from position: 76
Branch analysis from position: 57
Branch analysis from position: 19
filename:       /in/Jp9Jf
function name:  (null)
number of ops:  87
compiled vars:  !0 = $string, !1 = $string2, !2 = $json, !3 = $json2, !4 = $array0, !5 = $key, !6 = $array1, !7 = $row, !8 = $array2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%5B%0A++++%7B%0A++++++++%22id%22%3A+%227ac648ce-18aa-11e9-b673-005056be36b2%22%2C%0A++++++++%22answer%22%3A+%221%22%2C%0A++++++++%22id_question%22%3A+%2239%22%2C%0A++++++++%22pi%22%3A+%22very+good%22%2C%0A++++++++%22ca%22%3A+null%2C%0A++++++++%22pic%22%3A+null%2C%0A++++++++%22new_deadline%22%3A+null%2C%0A++++++++%22reason%22%3A+null%2C%0A++++++++%22notes%22%3A+null%2C%0A++++++++%22deadline%22%3A+null%0A++++%7D%2C%0A++++%7B%0A++++++++%22id%22%3A+%228653ef3d-18aa-11e9-b673-005056be36b2%22%2C%0A++++++++%22answer%22%3A+%223%22%2C%0A++++++++%22id_question%22%3A+%2240%22%2C%0A++++++++%22pi%22%3A+%22no+problem%22%2C%0A++++++++%22ca%22%3A+null%2C%0A++++++++%22pic%22%3A+null%2C%0A++++++++%22new_deadline%22%3A+null%2C%0A++++++++%22reason%22%3A+null%2C%0A++++++++%22notes%22%3A+null%2C%0A++++++++%22deadline%22%3A+null%0A++++%7D%0A%5D'
   30     1        ASSIGN                                                       !1, '%5B%0A++++%7B%0A++++++++%22id%22%3A+%2238%22%2C%0A++++++++%22question%22%3A+%22Kebersihan+Meja+Counter+dan+Meja+Fincoy+%22%2C%0A++++++++%22type%22%3A+%22NON+DOS%22%2C%0A++++++++%22last_root%22%3A+%221%22%2C%0A++++++++%22exist_good%22%3A+%221%22%2C%0A++++++++%22exist_not_good%22%3A+%220%22%2C%0A++++++++%22not_exist%22%3A+%221%22%2C%0A++++++++%22n_a%22%3A+%220%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22id%22%3A+%2239%22%2C%0A++++++++%22question%22%3A+%22Seragam+Sales+Counter+%2F+Salesman%2A+%22%2C%0A++++++++%22type%22%3A+%22NON+DOS%22%2C%0A++++++++%22last_root%22%3A+%221%22%2C%0A++++++++%22exist_good%22%3A+%221%22%2C%0A++++++++%22exist_not_good%22%3A+%220%22%2C%0A++++++++%22not_exist%22%3A+%221%22%2C%0A++++++++%22n_a%22%3A+%220%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22id%22%3A+%2240%22%2C%0A++++++++%22question%22%3A+%22Kerapihan+Sales+Counter%22%2C%0A++++++++%22type%22%3A+%22NON+DOS%22%2C%0A++++++++%22last_root%22%3A+%221%22%2C%0A++++++++%22exist_good%22%3A+%221%22%2C%0A++++++++%22exist_not_good%22%3A+%220%22%2C%0A++++++++%22not_exist%22%3A+%221%22%2C%0A++++++++%22n_a%22%3A+%220%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22id%22%3A+%2242%22%2C%0A++++++++%22question%22%3A+%22Sales+Guide%22%2C%0A++++++++%22type%22%3A+%22NON+DOS%22%2C%0A++++++++%22last_root%22%3A+%221%22%2C%0A++++++++%22exist_good%22%3A+%221%22%2C%0A++++++++%22exist_not_good%22%3A+%220%22%2C%0A++++++++%22not_exist%22%3A+%221%22%2C%0A++++++++%22n_a%22%3A+%220%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22id%22%3A+%2243%22%2C%0A++++++++%22question%22%3A+%22Product+Card%22%2C%0A++++++++%22type%22%3A+%22NON+DOS%22%2C%0A++++++++%22last_root%22%3A+%221%22%2C%0A++++++++%22exist_good%22%3A+%221%22%2C%0A++++++++%22exist_not_good%22%3A+%220%22%2C%0A++++++++%22not_exist%22%3A+%221%22%2C%0A++++++++%22n_a%22%3A+%220%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22id%22%3A+%2244%22%2C%0A++++++++%22question%22%3A+%22Ketersediaan+Buku+Tamu%22%2C%0A++++++++%22type%22%3A+%22NON+DOS%22%2C%0A++++++++%22last_root%22%3A+%221%22%2C%0A++++++++%22exist_good%22%3A+%221%22%2C%0A++++++++%22exist_not_good%22%3A+%220%22%2C%0A++++++++%22not_exist%22%3A+%221%22%2C%0A++++++++%22n_a%22%3A+%220%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22id%22%3A+%2245%22%2C%0A++++++++%22question%22%3A+%22Ketersediaan+Price+List%22%2C%0A++++++++%22type%22%3A+%22NON+DOS%22%2C%0A++++++++%22last_root%22%3A+%221%22%2C%0A++++++++%22exist_good%22%3A+%221%22%2C%0A++++++++%22exist_not_good%22%3A+%220%22%2C%0A++++++++%22not_exist%22%3A+%221%22%2C%0A++++++++%22n_a%22%3A+%220%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22id%22%3A+%2246%22%2C%0A++++++++%22question%22%3A+%22Ketersedian+Rak+Brosur+%22%2C%0A++++++++%22type%22%3A+%22NON+DOS%22%2C%0A++++++++%22last_root%22%3A+%221%22%2C%0A++++++++%22exist_good%22%3A+%221%22%2C%0A++++++++%22exist_not_good%22%3A+%220%22%2C%0A++++++++%22not_exist%22%3A+%221%22%2C%0A++++++++%22n_a%22%3A+%220%22%0A++++%7D%2C%0A++++%7B%0A++++++++%22id%22%3A+%2247%22%2C%0A++++++++%22question%22%3A+%22Ketersediaan+Flyer%2A%2Fbrosur%5Ct%22%2C%0A++++++++%22type%22%3A+%22NON+DOS%22%2C%0A++++++++%22last_root%22%3A+%221%22%2C%0A++++++++%22exist_good%22%3A+%221%22%2C%0A++++++++%22exist_not_good%22%3A+%220%22%2C%0A++++++++%22not_exist%22%3A+%221%22%2C%0A++++++++%22n_a%22%3A+%220%22%0A++++%7D%0A%5D'
  123     2        INIT_FCALL                                                   'json_decode'
          3        SEND_VAR                                                     !0
          4        SEND_VAL                                                     <true>
          5        DO_ICALL                                             $11     
          6        ASSIGN                                                       !2, $11
  124     7        INIT_FCALL                                                   'json_decode'
          8        SEND_VAR                                                     !1
          9        SEND_VAL                                                     <true>
         10        DO_ICALL                                             $13     
         11        ASSIGN                                                       !3, $13
  126    12        ASSIGN                                                       !4, <array>
  127    13      > FE_RESET_R                                           $16     !2, ->19
         14    > > FE_FETCH_R                                                   $16, !5, ->19
  129    15    >   FETCH_DIM_R                                          ~17     !5, 'id_question'
         16        ASSIGN_DIM                                                   !4, ~17
         17        OP_DATA                                                      !5
  127    18      > JMP                                                          ->14
         19    >   FE_FREE                                                      $16
  134    20        ASSIGN                                                       !6, <array>
  135    21      > FE_RESET_R                                           $20     !3, ->57
         22    > > FE_FETCH_R                                                   $20, !5, ->57
  138    23    >   FETCH_DIM_R                                          ~21     !5, 'id'
         24        FETCH_DIM_R                                          ~23     !5, 'question'
         25        ASSIGN_DIM                                                   !6, ~21
         26        OP_DATA                                                      ~23
  140    27        FETCH_DIM_R                                          ~24     !5, 'id'
         28        ISSET_ISEMPTY_DIM_OBJ                             0  ~25     !4, ~24
         29        BOOL_NOT                                             ~26     ~25
         30      > JMPZ                                                         ~26, ->56
  142    31    >   ASSIGN                                                       !7, <array>
  143    32        FETCH_DIM_R                                          ~29     !5, 'question'
         33        ASSIGN_DIM                                                   !7, 'id'
         34        OP_DATA                                                      ~29
  144    35        FETCH_DIM_R                                          ~31     !5, 'id'
         36        ASSIGN_DIM                                                   !7, 'id_question'
         37        OP_DATA                                                      ~31
  145    38        ASSIGN_DIM                                                   !7, 'answer'
         39        OP_DATA                                                      null
  146    40        ASSIGN_DIM                                                   !7, 'pi'
         41        OP_DATA                                                      null
  147    42        ASSIGN_DIM                                                   !7, 'ca'
         43        OP_DATA                                                      null
  148    44        ASSIGN_DIM                                                   !7, 'pic'
         45        OP_DATA                                                      null
  149    46        ASSIGN_DIM                                                   !7, 'new_deadline'
         47        OP_DATA                                                      null
  150    48        ASSIGN_DIM                                                   !7, 'reason'
         49        OP_DATA                                                      null
  151    50        ASSIGN_DIM                                                   !7, 'notes'
         51        OP_DATA                                                      null
  152    52        ASSIGN_DIM                                                   !7, 'deadline'
         53        OP_DATA                                                      null
  153    54        ASSIGN_DIM                                                   !4
         55        OP_DATA                                                      !7
  135    56    > > JMP                                                          ->22
         57    >   FE_FREE                                                      $20
  159    58        ASSIGN                                                       !8, <array>
  161    59      > FE_RESET_R                                           $42     !4, ->76
         60    > > FE_FETCH_R                                                   $42, !5, ->76
  164    61    >   FETCH_DIM_R                                          ~43     !5, 'id_question'
         62        FRAMELESS_ICALL_1                trim                ~44     ~43
         63        ISSET_ISEMPTY_DIM_OBJ                             0          !6, ~44
         64      > JMPZ                                                         ~45, ->69
  165    65    >   FETCH_DIM_R                                          ~47     !5, 'id_question'
         66        FETCH_DIM_R                                          ~48     !6, ~47
         67        ASSIGN_DIM                                                   !5, 'question'
         68        OP_DATA                                                      ~48
  168    69    >   FETCH_DIM_R                                          ~50     !5, 'id_question'
         70        ASSIGN_DIM                                                   !5, 'id'
         71        OP_DATA                                                      ~50
  169    72        UNSET_DIM                                                    !5, 'id_question'
  171    73        ASSIGN_DIM                                                   !8
         74        OP_DATA                                                      !5
  161    75      > JMP                                                          ->60
         76    >   FE_FREE                                                      $42
  182    77        INIT_FCALL                                                   'json_encode'
         78        SEND_VAR                                                     !8
         79        DO_ICALL                                             $52     
         80        ASSIGN                                                       !2, $52
  183    81        INIT_FCALL                                                   'print_r'
         82        SEND_VAR                                                     !2
         83        DO_ICALL                                                     
  186    84      > INIT_FCALL                                                   'exit'
         85*       DO_ICALL                                                     
  187    86*     > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.45 ms | 2643 KiB | 17 Q