3v4l.org

run code in 300+ PHP versions simultaneously
<?php function mergeAndBoolify($posted) { $result = []; foreach ($posted as $key1 => $value1) { if ($key1 === 'JsonData') { foreach (json_decode($value1, true) as $item) { foreach ($item as $key2 => $value2) { if (in_array($value2, ['true', 'false'])) { $value2 = json_decode($value2); } $result[$key2] = $value2; } } } else { $result[$key1] = $value1; } } return $result; } $_POST = [ 'JsonData' => '[{"firstname":"false"},{"lastname":"true"},{"email":""}]', 'otherdata' => 'otherdata' ]; var_export(mergeAndBoolify($_POST));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DLiqu
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   FETCH_W                      global              $0      '_POST'
          1        ASSIGN                                                   $0, <array>
   27     2        INIT_FCALL                                               'var_export'
          3        INIT_FCALL                                               'mergeandboolify'
          4        FETCH_R                      global              ~2      '_POST'
          5        SEND_VAL                                                 ~2
          6        DO_FCALL                                      0  $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function mergeandboolify:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 32
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 32
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 29
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 27
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 27
Branch analysis from position: 13
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
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 22
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 25
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 27
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/DLiqu
function name:  mergeAndBoolify
number of ops:  35
compiled vars:  !0 = $posted, !1 = $result, !2 = $value1, !3 = $key1, !4 = $item, !5 = $value2, !6 = $key2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2      > FE_RESET_R                                       $8      !0, ->32
          3    > > FE_FETCH_R                                       ~9      $8, !2, ->32
          4    >   ASSIGN                                                   !3, ~9
    6     5        IS_IDENTICAL                                             !3, 'JsonData'
          6      > JMPZ                                                     ~11, ->29
    7     7    >   INIT_FCALL                                               'json_decode'
          8        SEND_VAR                                                 !2
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $12     
         11      > FE_RESET_R                                       $13     $12, ->27
         12    > > FE_FETCH_R                                               $13, !4, ->27
    8    13    > > FE_RESET_R                                       $14     !4, ->25
         14    > > FE_FETCH_R                                       ~15     $14, !5, ->25
         15    >   ASSIGN                                                   !6, ~15
    9    16        IN_ARRAY                                                 !5, <array>
         17      > JMPZ                                                     ~17, ->22
   10    18    >   INIT_FCALL                                               'json_decode'
         19        SEND_VAR                                                 !5
         20        DO_ICALL                                         $18     
         21        ASSIGN                                                   !5, $18
   12    22    >   ASSIGN_DIM                                               !1, !6
         23        OP_DATA                                                  !5
    8    24      > JMP                                                      ->14
         25    >   FE_FREE                                                  $14
    7    26      > JMP                                                      ->12
         27    >   FE_FREE                                                  $13
         28      > JMP                                                      ->31
   16    29    >   ASSIGN_DIM                                               !1, !3
         30        OP_DATA                                                  !2
    5    31    > > JMP                                                      ->3
         32    >   FE_FREE                                                  $8
   19    33      > RETURN                                                   !1
   20    34*     > RETURN                                                   null

End of function mergeandboolify

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.66 ms | 1407 KiB | 18 Q