3v4l.org

run code in 300+ PHP versions simultaneously
<?php $itinerary = array (array('portName'=>'Day At Sea'), array('portName'=>'Moscow'), array('portName'=>'Jupiter')); $badPorts = array('At Sea', 'Day At Sea', 'Cruising The Mediterranean Sea'); $image = ''; array_walk($itinerary, function($item, $index) use(&$image, $badPorts){ if(!in_array($item['portName'], $badPorts)) $image .= $index.":".$item['portName'].","; }); var_dump($image); $image2 = ''; foreach($itinerary as $index => $item){ if(!in_array($item['portName'], $badPorts)) $image2 .= $index.":".$item['portName'].","; } var_dump($image2);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 30
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 30
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 29
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 29
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/E0YbR
function name:  (null)
number of ops:  35
compiled vars:  !0 = $itinerary, !1 = $badPorts, !2 = $image, !3 = $image2, !4 = $item, !5 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, ''
    6     3        INIT_FCALL                                               'array_walk'
          4        SEND_REF                                                 !0
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FE0YbR%3A6%240'
          6        BIND_LEXICAL                                             ~9, !2
          7        BIND_LEXICAL                                             ~9, !1
    8     8        SEND_VAL                                                 ~9
          9        DO_ICALL                                                 
    9    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
   11    13        ASSIGN                                                   !3, ''
   12    14      > FE_RESET_R                                       $13     !0, ->30
         15    > > FE_FETCH_R                                       ~14     $13, !4, ->30
         16    >   ASSIGN                                                   !5, ~14
   13    17        INIT_FCALL                                               'in_array'
         18        FETCH_DIM_R                                      ~16     !4, 'portName'
         19        SEND_VAL                                                 ~16
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                         $17     
         22        BOOL_NOT                                         ~18     $17
         23      > JMPZ                                                     ~18, ->29
         24    >   CONCAT                                           ~19     !5, '%3A'
         25        FETCH_DIM_R                                      ~20     !4, 'portName'
         26        CONCAT                                           ~21     ~19, ~20
         27        CONCAT                                           ~22     ~21, '%2C'
         28        ASSIGN_OP                                     8          !3, ~22
   12    29    > > JMP                                                      ->15
         30    >   FE_FREE                                                  $13
   15    31        INIT_FCALL                                               'var_dump'
         32        SEND_VAR                                                 !3
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FE0YbR%3A6%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/E0YbR
function name:  {closure}
number of ops:  17
compiled vars:  !0 = $item, !1 = $index, !2 = $image, !3 = $badPorts
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
    7     4        INIT_FCALL                                               'in_array'
          5        FETCH_DIM_R                                      ~4      !0, 'portName'
          6        SEND_VAL                                                 ~4
          7        SEND_VAR                                                 !3
          8        DO_ICALL                                         $5      
          9        BOOL_NOT                                         ~6      $5
         10      > JMPZ                                                     ~6, ->16
         11    >   CONCAT                                           ~7      !1, '%3A'
         12        FETCH_DIM_R                                      ~8      !0, 'portName'
         13        CONCAT                                           ~9      ~7, ~8
         14        CONCAT                                           ~10     ~9, '%2C'
         15        ASSIGN_OP                                     8          !2, ~10
    8    16    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FE0YbR%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.7 ms | 1400 KiB | 19 Q