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 = ''; $arr = array(); array_walk($itinerary, function($item, $index) use(&$image, $badPorts){ if(!in_array($item['portName'], $badPorts)) $arr[] = $index.":".$item['portName']; }); $image .= implode(',', $arr); var_dump($image); $image2 = ''; $arr2 = array(); foreach($itinerary as $index => $item){ if(!in_array($item['portName'], $badPorts)) $arr2[] = $index.":".$item['portName']; } $image2 .= implode(',', $arr2); var_dump($image2);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 37
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 37
Branch analysis from position: 23
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 36
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 36
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/lrJki
function name:  (null)
number of ops:  47
compiled vars:  !0 = $itinerary, !1 = $badPorts, !2 = $image, !3 = $arr, !4 = $image2, !5 = $arr2, !6 = $item, !7 = $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        ASSIGN                                                   !3, <array>
    7     4        INIT_FCALL                                               'array_walk'
          5        SEND_REF                                                 !0
          6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FlrJki%3A7%240'
          7        BIND_LEXICAL                                             ~12, !2
          8        BIND_LEXICAL                                             ~12, !1
    9     9        SEND_VAL                                                 ~12
         10        DO_ICALL                                                 
   10    11        INIT_FCALL                                               'implode'
         12        SEND_VAL                                                 '%2C'
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                         $14     
         15        ASSIGN_OP                                     8          !2, $14
   11    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                                 
   13    19        ASSIGN                                                   !4, ''
   14    20        ASSIGN                                                   !5, <array>
   15    21      > FE_RESET_R                                       $19     !0, ->37
         22    > > FE_FETCH_R                                       ~20     $19, !6, ->37
         23    >   ASSIGN                                                   !7, ~20
   16    24        INIT_FCALL                                               'in_array'
         25        FETCH_DIM_R                                      ~22     !6, 'portName'
         26        SEND_VAL                                                 ~22
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                         $23     
         29        BOOL_NOT                                         ~24     $23
         30      > JMPZ                                                     ~24, ->36
         31    >   CONCAT                                           ~26     !7, '%3A'
         32        FETCH_DIM_R                                      ~27     !6, 'portName'
         33        CONCAT                                           ~28     ~26, ~27
         34        ASSIGN_DIM                                               !5
         35        OP_DATA                                                  ~28
   15    36    > > JMP                                                      ->22
         37    >   FE_FREE                                                  $19
   18    38        INIT_FCALL                                               'implode'
         39        SEND_VAL                                                 '%2C'
         40        SEND_VAR                                                 !5
         41        DO_ICALL                                         $29     
         42        ASSIGN_OP                                     8          !4, $29
   19    43        INIT_FCALL                                               'var_dump'
         44        SEND_VAR                                                 !4
         45        DO_ICALL                                                 
         46      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FlrJki%3A7%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/lrJki
function name:  {closure}
number of ops:  17
compiled vars:  !0 = $item, !1 = $index, !2 = $image, !3 = $badPorts, !4 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
    8     4        INIT_FCALL                                               'in_array'
          5        FETCH_DIM_R                                      ~5      !0, 'portName'
          6        SEND_VAL                                                 ~5
          7        SEND_VAR                                                 !3
          8        DO_ICALL                                         $6      
          9        BOOL_NOT                                         ~7      $6
         10      > JMPZ                                                     ~7, ->16
         11    >   CONCAT                                           ~9      !1, '%3A'
         12        FETCH_DIM_R                                      ~10     !0, 'portName'
         13        CONCAT                                           ~11     ~9, ~10
         14        ASSIGN_DIM                                               !4
         15        OP_DATA                                                  ~11
    9    16    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FlrJki%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.85 ms | 1400 KiB | 21 Q