3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = Array ( 'user_id' => 10, 'id' => 2, 'user' => 'Nakiya', ); /** * Check if an item is in an array. */ function contains($array, $value) { return in_array($value, $array, true); } $result_1 = contains($array,'Nakiya'); echo "item available =>"; if($result_1){ echo "success"; }else{ echo "fail"; } echo " item not available =>"; $result_2 = contains($array,'Nakiya10'); if($result_2){ echo "success <br>"; }else{ echo "fail"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
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
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
Branch analysis from position: 20
filename:       /in/5cv60
function name:  (null)
number of ops:  22
compiled vars:  !0 = $array, !1 = $result_1, !2 = $result_2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   20     1        INIT_FCALL                                               'contains'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'Nakiya'
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !1, $4
   22     6        ECHO                                                     'item+available+%3D%3E'
   24     7      > JMPZ                                                     !1, ->10
   25     8    >   ECHO                                                     'success'
   24     9      > JMP                                                      ->11
   27    10    >   ECHO                                                     'fail'
   30    11    >   ECHO                                                     '+item+not+available+%3D%3E'
   31    12        INIT_FCALL                                               'contains'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 'Nakiya10'
         15        DO_FCALL                                      0  $6      
         16        ASSIGN                                                   !2, $6
   32    17      > JMPZ                                                     !2, ->20
   33    18    >   ECHO                                                     'success+%3Cbr%3E'
   32    19      > JMP                                                      ->21
   35    20    >   ECHO                                                     'fail'
   37    21    > > RETURN                                                   1

Function contains:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5cv60
function name:  contains
number of ops:  9
compiled vars:  !0 = $array, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        INIT_FCALL                                               'in_array'
          3        SEND_VAR                                                 !1
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $2      
          7      > RETURN                                                   $2
   17     8*     > RETURN                                                   null

End of function contains

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.41 ms | 958 KiB | 16 Q