3v4l.org

run code in 300+ PHP versions simultaneously
<?php function c_in_array($needle, $haystack){ if(!is_array($haystack)){ return false; } foreach($haystack as $index => $value){ var_dump($index, $value); if(is_array($value)){ return c_in_array($needle, $value); }else{ if($needle == $value){ return true; } } } return false; } $array = []; $array[] = ['content' => '192.168.178.1', 'disabled' => true]; $array[] = ['content' => '192.168.178.2', 'disabled' => false]; var_dump($array, c_in_array('192.168.178.4', $array)); //var_dump($array, array_search('192.168.178.2', $array));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bqXSn
function name:  (null)
number of ops:  14
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   ASSIGN                                                   !0, <array>
   22     1        ASSIGN_DIM                                               !0
          2        OP_DATA                                                  <array>
   23     3        ASSIGN_DIM                                               !0
          4        OP_DATA                                                  <array>
   25     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        INIT_FCALL                                               'c_in_array'
          8        SEND_VAL                                                 '192.168.178.4'
          9        SEND_VAR                                                 !0
         10        DO_FCALL                                      0  $4      
         11        SEND_VAR                                                 $4
         12        DO_ICALL                                                 
   26    13      > RETURN                                                   1

Function c_in_array:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 27
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 27
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/bqXSn
function name:  c_in_array
number of ops:  30
compiled vars:  !0 = $needle, !1 = $haystack, !2 = $value, !3 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        TYPE_CHECK                                  128  ~4      !1
          3        BOOL_NOT                                         ~5      ~4
          4      > JMPZ                                                     ~5, ->6
    4     5    > > RETURN                                                   <false>
    7     6    > > FE_RESET_R                                       $6      !1, ->27
          7    > > FE_FETCH_R                                       ~7      $6, !2, ->27
          8    >   ASSIGN                                                   !3, ~7
    8     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !3
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
    9    13        TYPE_CHECK                                  128          !2
         14      > JMPZ                                                     ~10, ->22
   10    15    >   INIT_FCALL_BY_NAME                                       'c_in_array'
         16        SEND_VAR_EX                                              !0
         17        SEND_VAR_EX                                              !2
         18        DO_FCALL                                      0  $11     
         19        FE_FREE                                                  $6
         20      > RETURN                                                   $11
         21*       JMP                                                      ->26
   12    22    >   IS_EQUAL                                                 !0, !2
         23      > JMPZ                                                     ~12, ->26
   13    24    >   FE_FREE                                                  $6
         25      > RETURN                                                   <true>
    7    26    > > JMP                                                      ->7
         27    >   FE_FREE                                                  $6
   18    28      > RETURN                                                   <false>
   19    29*     > RETURN                                                   null

End of function c_in_array

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.05 ms | 1403 KiB | 16 Q