3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '[ { "seasonNumber":1, "numWins":1, "numHighBracket":2, "numLowBracket":2, "seasonXp":111, "seasonLevel":5, "bookXp":0, "bookLevel":1, "purchasedVIP":false }, { "seasonNumber":2, "numWins":1, "numHighBracket":21, "numLowBracket":31, "seasonXp":1651, "seasonLevel":25, "bookXp":9, "bookLevel":11, "purchasedVIP":false }, { "seasonNumber":3, "numWins":9, "numHighBracket":57, "numLowBracket":127, "seasonXp":4659, "seasonLevel":68, "bookXp":0, "bookLevel":100, "purchasedVIP":true }, { "seasonNumber":4, "numWins":8, "numHighBracket":19, "numLowBracket":36, "seasonXp":274, "seasonLevel":33, "bookXp":7, "bookLevel":35, "purchasedVIP":true } ]'; foreach (json_decode($json) as $set) { $array[] = ["season" => $set->seasonNumber, "battle_pass" => $set->purchasedVIP]; } echo json_encode(["seasons" => $array], JSON_FORCE_OBJECT | JSON_PRETTY_PRINT);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/qsPb0
function name:  (null)
number of ops:  21
compiled vars:  !0 = $json, !1 = $set, !2 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%5B%0A++%7B%0A++++++%22seasonNumber%22%3A1%2C%0A++++++%22numWins%22%3A1%2C%0A++++++%22numHighBracket%22%3A2%2C%0A++++++%22numLowBracket%22%3A2%2C%0A++++++%22seasonXp%22%3A111%2C%0A++++++%22seasonLevel%22%3A5%2C%0A++++++%22bookXp%22%3A0%2C%0A++++++%22bookLevel%22%3A1%2C%0A++++++%22purchasedVIP%22%3Afalse%0A+++%7D%2C%0A+++%7B%0A++++++%22seasonNumber%22%3A2%2C%0A++++++%22numWins%22%3A1%2C%0A++++++%22numHighBracket%22%3A21%2C%0A++++++%22numLowBracket%22%3A31%2C%0A++++++%22seasonXp%22%3A1651%2C%0A++++++%22seasonLevel%22%3A25%2C%0A++++++%22bookXp%22%3A9%2C%0A++++++%22bookLevel%22%3A11%2C%0A++++++%22purchasedVIP%22%3Afalse%0A+++%7D%2C%0A+++%7B%0A++++++%22seasonNumber%22%3A3%2C%0A++++++%22numWins%22%3A9%2C%0A++++++%22numHighBracket%22%3A57%2C%0A++++++%22numLowBracket%22%3A127%2C%0A++++++%22seasonXp%22%3A4659%2C%0A++++++%22seasonLevel%22%3A68%2C%0A++++++%22bookXp%22%3A0%2C%0A++++++%22bookLevel%22%3A100%2C%0A++++++%22purchasedVIP%22%3Atrue%0A+++%7D%2C%0A+++%7B%0A++++++%22seasonNumber%22%3A4%2C%0A++++++%22numWins%22%3A8%2C%0A++++++%22numHighBracket%22%3A19%2C%0A++++++%22numLowBracket%22%3A36%2C%0A++++++%22seasonXp%22%3A274%2C%0A++++++%22seasonLevel%22%3A33%2C%0A++++++%22bookXp%22%3A7%2C%0A++++++%22bookLevel%22%3A35%2C%0A++++++%22purchasedVIP%22%3Atrue%0A+++%7D%0A%5D'
   48     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4      > FE_RESET_R                                       $5      $4, ->13
          5    > > FE_FETCH_R                                               $5, !1, ->13
   49     6    >   FETCH_OBJ_R                                      ~7      !1, 'seasonNumber'
          7        INIT_ARRAY                                       ~8      ~7, 'season'
          8        FETCH_OBJ_R                                      ~9      !1, 'purchasedVIP'
          9        ADD_ARRAY_ELEMENT                                ~8      ~9, 'battle_pass'
         10        ASSIGN_DIM                                               !2
         11        OP_DATA                                                  ~8
   48    12      > JMP                                                      ->5
         13    >   FE_FREE                                                  $5
   51    14        INIT_FCALL                                               'json_encode'
         15        INIT_ARRAY                                       ~10     !2, 'seasons'
         16        SEND_VAL                                                 ~10
         17        SEND_VAL                                                 144
         18        DO_ICALL                                         $11     
         19        ECHO                                                     $11
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.99 ms | 1439 KiB | 15 Q