3v4l.org

run code in 300+ PHP versions simultaneously
<?php $results = array ( 0 => array ( 'id' => 1, 'location' => 3, 'location_fees' => 3, 'gross_percentage' => 25, 'transaction_percentage' => 0, 'user_name' => 'admin', 'user_id' => 1, 'gross' => 'yes', 'transaction' => 'no' ), 1 => array ( 'id' => 2, 'location' => 5, 'location_fees' => 5, 'gross_percentage' => 0, 'transaction_percentage' => 24, 'user_name' => 'admin', 'user_id' => 1, 'gross' => 'no', 'transaction' => 'yes' ), 2 => array ( 'id' => 3, 'location' => 2, 'location_fees' => 5, 'gross_percentage' => 10, 'transaction_percentage' => 0, 'user_name' => 'admin', 'user_id' => 1, 'gross' => 'yes', 'transaction' => 'no' ) ); $search = ['gross' => 'yes']; foreach ($results as $k => $v) { echo "key $k<br>" . PHP_EOL; if ($v['gross'] == $search['gross'] ) { $location_fees = $v['location_fees']; echo "The location fees: ". $location_fees ." % <br><br>" . PHP_EOL; $gross_percentage = $v['gross_percentage']; echo "The gross_percentage is: ".$gross_percentage ."% <br><br>" . PHP_EOL; } else { $tran_perc = $v['transaction_percentage']; echo "The locations percentage is: ".$tran_perc ." % <br>" . PHP_EOL; $the_loc = $v['location']; echo "The location is: ".$the_loc ." <br>" . PHP_EOL; $location_fees = $v['location_fees']; echo "The location fees: ". $location_fees ." % <br><br>" . PHP_EOL; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 46
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 46
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 27
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
filename:       /in/gTBf7
function name:  (null)
number of ops:  48
compiled vars:  !0 = $results, !1 = $search, !2 = $v, !3 = $k, !4 = $location_fees, !5 = $gross_percentage, !6 = $tran_perc, !7 = $the_loc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   42     1        ASSIGN                                                   !1, <array>
   43     2      > FE_RESET_R                                       $10     !0, ->46
          3    > > FE_FETCH_R                                       ~11     $10, !2, ->46
          4    >   ASSIGN                                                   !3, ~11
   44     5        ROPE_INIT                                     3  ~14     'key+'
          6        ROPE_ADD                                      1  ~14     ~14, !3
          7        ROPE_END                                      2  ~13     ~14, '%3Cbr%3E'
          8        CONCAT                                           ~16     ~13, '%0A'
          9        ECHO                                                     ~16
   45    10        FETCH_DIM_R                                      ~17     !2, 'gross'
         11        FETCH_DIM_R                                      ~18     !1, 'gross'
         12        IS_EQUAL                                                 ~17, ~18
         13      > JMPZ                                                     ~19, ->27
   46    14    >   FETCH_DIM_R                                      ~20     !2, 'location_fees'
         15        ASSIGN                                                   !4, ~20
   47    16        CONCAT                                           ~22     'The+location+fees%3A+', !4
         17        CONCAT                                           ~23     ~22, '+%25+%3Cbr%3E%3Cbr%3E'
         18        CONCAT                                           ~24     ~23, '%0A'
         19        ECHO                                                     ~24
   49    20        FETCH_DIM_R                                      ~25     !2, 'gross_percentage'
         21        ASSIGN                                                   !5, ~25
   50    22        CONCAT                                           ~27     'The+gross_percentage+is%3A+', !5
         23        CONCAT                                           ~28     ~27, '%25+%3Cbr%3E%3Cbr%3E'
         24        CONCAT                                           ~29     ~28, '%0A'
         25        ECHO                                                     ~29
   45    26      > JMP                                                      ->45
   54    27    >   FETCH_DIM_R                                      ~30     !2, 'transaction_percentage'
         28        ASSIGN                                                   !6, ~30
   55    29        CONCAT                                           ~32     'The+locations+percentage+is%3A+', !6
         30        CONCAT                                           ~33     ~32, '+%25+%3Cbr%3E'
         31        CONCAT                                           ~34     ~33, '%0A'
         32        ECHO                                                     ~34
   57    33        FETCH_DIM_R                                      ~35     !2, 'location'
         34        ASSIGN                                                   !7, ~35
   58    35        CONCAT                                           ~37     'The+location+is%3A+', !7
         36        CONCAT                                           ~38     ~37, '++%3Cbr%3E'
         37        CONCAT                                           ~39     ~38, '%0A'
         38        ECHO                                                     ~39
   60    39        FETCH_DIM_R                                      ~40     !2, 'location_fees'
         40        ASSIGN                                                   !4, ~40
   61    41        CONCAT                                           ~42     'The+location+fees%3A+', !4
         42        CONCAT                                           ~43     ~42, '+%25+%3Cbr%3E%3Cbr%3E'
         43        CONCAT                                           ~44     ~43, '%0A'
         44        ECHO                                                     ~44
   43    45    > > JMP                                                      ->3
         46    >   FE_FREE                                                  $10
   63    47      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.8 ms | 1447 KiB | 13 Q