3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rates = array( 'apple' => array( 'red' => 1.19, 'green' => 0.99, 'yellow' => 0.89 ) ); $cart = array( 'apple' => array( '0' => 'red', '1' => 'green' ) ); $total = 0; foreach ($cart as $key => $arr) { if (isset($rates[$key])) { foreach ($arr as $value) { $total += $rates[$key][$value] ?? 0; } } } echo $total;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 18
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 16
Branch analysis from position: 17
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/eSn3C
function name:  (null)
number of ops:  21
compiled vars:  !0 = $rates, !1 = $cart, !2 = $total, !3 = $arr, !4 = $key, !5 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   18     2        ASSIGN                                                   !2, 0
   19     3      > FE_RESET_R                                       $9      !1, ->18
          4    > > FE_FETCH_R                                       ~10     $9, !3, ->18
          5    >   ASSIGN                                                   !4, ~10
   20     6        ISSET_ISEMPTY_DIM_OBJ                         0          !0, !4
          7      > JMPZ                                                     ~12, ->17
   21     8    > > FE_RESET_R                                       $13     !3, ->16
          9    > > FE_FETCH_R                                               $13, !5, ->16
   22    10    >   FETCH_DIM_IS                                     ~14     !0, !4
         11        FETCH_DIM_IS                                     ~15     ~14, !5
         12        COALESCE                                         ~16     ~15
         13        QM_ASSIGN                                        ~16     0
         14        ASSIGN_OP                                     1          !2, ~16
   21    15      > JMP                                                      ->9
         16    >   FE_FREE                                                  $13
   19    17    > > JMP                                                      ->4
         18    >   FE_FREE                                                  $9
   26    19        ECHO                                                     !2
   27    20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.64 ms | 1442 KiB | 13 Q