3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json_string = '{"options": [ { "optionID" : 123 }, { "optionID" : 456 }, { "optionID" : 789 } ]}'; $idpassed = 123; $options = json_decode($json_string, 1)['options']; if (array_search($idpassed, array_column($options, 'optionID')) !== FALSE) { echo "the option exists!"; } else { echo "the option does not exist!"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a30mV
function name:  (null)
number of ops:  22
compiled vars:  !0 = $json_string, !1 = $idpassed, !2 = $options
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%22options%22%3A+%5B%0A++++++++%7B%0A+++++++++++%22optionID%22+%3A+123%0A++++++++%7D%2C%0A++++++++%7B%0A+++++++++++%22optionID%22+%3A+456%0A++++++++%7D%2C%0A++++++++%7B%0A+++++++++++%22optionID%22+%3A+789%0A++++++++%7D%0A%5D%7D'
   15     1        ASSIGN                                                   !1, 123
   16     2        INIT_FCALL                                               'json_decode'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 1
          5        DO_ICALL                                         $5      
          6        FETCH_DIM_R                                      ~6      $5, 'options'
          7        ASSIGN                                                   !2, ~6
   17     8        INIT_FCALL                                               'array_search'
          9        SEND_VAR                                                 !1
         10        INIT_FCALL                                               'array_column'
         11        SEND_VAR                                                 !2
         12        SEND_VAL                                                 'optionID'
         13        DO_ICALL                                         $8      
         14        SEND_VAR                                                 $8
         15        DO_ICALL                                         $9      
         16        TYPE_CHECK                                  1018          $9
         17      > JMPZ                                                     ~10, ->20
   18    18    >   ECHO                                                     'the+option+exists%21'
   17    19      > JMP                                                      ->21
   20    20    >   ECHO                                                     'the+option+does+not+exist%21'
   21    21    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
278.68 ms | 1012 KiB | 16 Q