3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( array("PROPERTIES" => array(1122), "QUANTITY" => "11"), array("PROPERTIES" => array(1123), "QUANTITY" => "12") ); function getQuantityById($id) { global $arr; foreach ($arr as $item) { if ($item["PROPERTIES"][0] == $id) return $item["QUEANTITY"]; } return null; } echo getQuantityById(1122);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/a9kQv
function name:  (null)
number of ops:  6
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   16     1        INIT_FCALL                                               'getquantitybyid'
          2        SEND_VAL                                                 1122
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function getquantitybyid:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/a9kQv
function name:  getQuantityById
number of ops:  15
compiled vars:  !0 = $id, !1 = $arr, !2 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        BIND_GLOBAL                                              !1, 'arr'
   10     2      > FE_RESET_R                                       $3      !1, ->12
          3    > > FE_FETCH_R                                               $3, !2, ->12
   11     4    >   FETCH_DIM_R                                      ~4      !2, 'PROPERTIES'
          5        FETCH_DIM_R                                      ~5      ~4, 0
          6        IS_EQUAL                                                 !0, ~5
          7      > JMPZ                                                     ~6, ->11
          8    >   FETCH_DIM_R                                      ~7      !2, 'QUEANTITY'
          9        FE_FREE                                                  $3
         10      > RETURN                                                   ~7
   10    11    > > JMP                                                      ->3
         12    >   FE_FREE                                                  $3
   13    13      > RETURN                                                   null
   14    14*     > RETURN                                                   null

End of function getquantitybyid

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.16 ms | 1390 KiB | 14 Q