3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = [ [ 'id' => 1, 'name' => 'Andorra', 'code' => 'AD', 'currency' => 'EUR', 'phone' => '+376', 'rate' => '5727.21', ], [ 'id' => 2, 'name' => 'United Arab Emirates', 'code' => 'AE', 'currency' => 'AED', 'phone' => '+971', 'rate' => '24341.9', ] ]; function getCurrency($code, $currenciesArray) { foreach ($currenciesArray as $row) { if ($row['currency'] == $code) { return $row; } } return false; } $currency = getCurrency('EUR', $x); echo $currency['rate'];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DnDQo
function name:  (null)
number of ops:  9
compiled vars:  !0 = $x, !1 = $currency
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   34     1        INIT_FCALL                                               'getcurrency'
          2        SEND_VAL                                                 'EUR'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !1, $3
   35     6        FETCH_DIM_R                                      ~5      !1, 'rate'
          7        ECHO                                                     ~5
          8      > RETURN                                                   1

Function getcurrency:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/DnDQo
function name:  getCurrency
number of ops:  13
compiled vars:  !0 = $code, !1 = $currenciesArray, !2 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   25     2      > FE_RESET_R                                       $3      !1, ->10
          3    > > FE_FETCH_R                                               $3, !2, ->10
   26     4    >   FETCH_DIM_R                                      ~4      !2, 'currency'
          5        IS_EQUAL                                                 !0, ~4
          6      > JMPZ                                                     ~5, ->9
   27     7    >   FE_FREE                                                  $3
          8      > RETURN                                                   !2
   25     9    > > JMP                                                      ->3
         10    >   FE_FREE                                                  $3
   31    11      > RETURN                                                   <false>
   32    12*     > RETURN                                                   null

End of function getcurrency

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
229.52 ms | 1001 KiB | 14 Q