3v4l.org

run code in 300+ PHP versions simultaneously
<?php $listing = [ [ "sku,qty,is_in_stock" ], [ "EBCDAA014MAS34B,149.000000,1" ] ]; function array_find($needle, array $haystack) { foreach ($haystack as $key => $value) { if (false !== stripos($value[0], $needle)) { return $key; } } return false; } $hello = array_find('EBCDAA014MAS34B', $listing); echo $hello; echo PHP_EOL; $test = array_find('QEBCDAA014MAS34B', $listing); var_dump($test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OIATZ
function name:  (null)
number of ops:  17
compiled vars:  !0 = $listing, !1 = $hello, !2 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   22     1        INIT_FCALL                                               'array_find'
          2        SEND_VAL                                                 'EBCDAA014MAS34B'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !1, $4
   23     6        ECHO                                                     !1
   25     7        ECHO                                                     '%0A'
   27     8        INIT_FCALL                                               'array_find'
          9        SEND_VAL                                                 'QEBCDAA014MAS34B'
         10        SEND_VAR                                                 !0
         11        DO_FCALL                                      0  $6      
         12        ASSIGN                                                   !2, $6
   28    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function array_find:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/OIATZ
function name:  array_find
number of ops:  18
compiled vars:  !0 = $needle, !1 = $haystack, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2      > FE_RESET_R                                       $4      !1, ->15
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->15
          4    >   ASSIGN                                                   !3, ~5
   15     5        INIT_FCALL                                               'stripos'
          6        FETCH_DIM_R                                      ~7      !2, 0
          7        SEND_VAL                                                 ~7
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $8      
         10        TYPE_CHECK                                  1018          $8
         11      > JMPZ                                                     ~9, ->14
   16    12    >   FE_FREE                                                  $4
         13      > RETURN                                                   !3
   14    14    > > JMP                                                      ->3
         15    >   FE_FREE                                                  $4
   19    16      > RETURN                                                   <false>
   20    17*     > RETURN                                                   null

End of function array_find

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151 ms | 1017 KiB | 16 Q