3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( array("key" => "net_sale", "value" => "NET SALE CRTN"), array("key" => "productive_calls", "value" => "Productive Calls"), array("key" => "drop_size_value", "value" => "DROP SIZE VALUE"), array("key" => "sku", "value" => "SKU PER BILL"), array("key" => "net_amount", "value" => "Net Amount"), array("key" => "drop_size_crtn", "value" => "DROP SIZE CRTN"), array("key" => "productive_pops", "value" => "PRODUCTIVE POPS"), array("key" => "scheduled_pops", "value" => "SCHEDULED POPS") ); function search($term, $array) { for ($i=0; $i<count($array); $i++) { if ($array[$i]['key'] == $term) return $i; } } echo search("net_amount", $array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/P4lbq
function name:  (null)
number of ops:  7
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ASSIGN                                                   !0, <array>
   18     1        INIT_FCALL                                               'search'
          2        SEND_VAL                                                 'net_amount'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
          6      > RETURN                                                   1

Function search:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 4
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 4
Branch analysis from position: 13
Branch analysis from position: 4
filename:       /in/P4lbq
function name:  search
number of ops:  14
compiled vars:  !0 = $term, !1 = $array, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->10
   14     4    >   FETCH_DIM_R                                      ~4      !1, !2
          5        FETCH_DIM_R                                      ~5      ~4, 'key'
          6        IS_EQUAL                                                 !0, ~5
          7      > JMPZ                                                     ~6, ->9
          8    > > RETURN                                                   !2
   13     9    >   PRE_INC                                                  !2
         10    >   COUNT                                            ~8      !1
         11        IS_SMALLER                                               !2, ~8
         12      > JMPNZ                                                    ~9, ->4
   16    13    > > RETURN                                                   null

End of function search

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.83 ms | 1402 KiB | 14 Q