3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $transactionId = "Sok234141341"; $gaClientId = "41233412.31231"; $redisData = $transactionId; $redisData = json_encode([ 'transactionId' => $transactionId, 'gaClientId' => $gaClientId ]); $data = json_decode($redisData); $tid = $data['transactionId']; $gid = $data['gaClientId']; var_dump("$tid $gid"); if (json_last_error() !== JSON_ERROR_NONE) { $tid = $data; $gid = null; } var_dump("$tid $gid");
based on KIdD3
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/5sj57
function name:  (null)
number of ops:  36
compiled vars:  !0 = $transactionId, !1 = $gaClientId, !2 = $redisData, !3 = $data, !4 = $tid, !5 = $gid
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   ASSIGN                                                   !0, 'Sok234141341'
   4     1        ASSIGN                                                   !1, '41233412.31231'
   6     2        ASSIGN                                                   !2, !0
   8     3        INIT_FCALL                                               'json_encode'
   9     4        INIT_ARRAY                                       ~9      !0, 'transactionId'
  10     5        ADD_ARRAY_ELEMENT                                ~9      !1, 'gaClientId'
         6        SEND_VAL                                                 ~9
         7        DO_ICALL                                         $10     
         8        ASSIGN                                                   !2, $10
  13     9        INIT_FCALL                                               'json_decode'
        10        SEND_VAR                                                 !2
        11        DO_ICALL                                         $12     
        12        ASSIGN                                                   !3, $12
  14    13        FETCH_DIM_R                                      $14     !3, 'transactionId'
        14        ASSIGN                                                   !4, $14
  15    15        FETCH_DIM_R                                      $16     !3, 'gaClientId'
        16        ASSIGN                                                   !5, $16
  17    17        INIT_FCALL                                               'var_dump'
        18        ROPE_INIT                                     3  ~19     !4
        19        ROPE_ADD                                      1  ~19     ~19, '+'
        20        ROPE_END                                      2  ~18     ~19, !5
        21        SEND_VAL                                                 ~18
        22        DO_ICALL                                                 
  19    23        INIT_FCALL                                               'json_last_error'
        24        DO_ICALL                                         $22     
        25        IS_NOT_IDENTICAL                                 ~23     $22, 0
        26      > JMPZ                                                     ~23, ->29
  20    27    >   ASSIGN                                                   !4, !3
  21    28        ASSIGN                                                   !5, null
  24    29    >   INIT_FCALL                                               'var_dump'
        30        ROPE_INIT                                     3  ~27     !4
        31        ROPE_ADD                                      1  ~27     ~27, '+'
        32        ROPE_END                                      2  ~26     ~27, !5
        33        SEND_VAL                                                 ~26
        34        DO_ICALL                                                 
        35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.3.0