3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [ 0 => 'AXA', 1 => 'VHV', 2 => 'TEST', ]; $doctypes = [ 12 => 'AXA', 156 => 'VHV', 8 => 'TEST', ]; $tops = array_map( function (string $name) use ($doctypes) { return in_array($name, $doctypes) ? $name : null; }, $a ); var_dump($tops); exit;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/hcMLQ
function name:  (null)
number of ops:  14
compiled vars:  !0 = $a, !1 = $doctypes, !2 = $tops
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   15     2        INIT_FCALL                                               'array_map'
   16     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FhcMLQ%3A16%240'
          4        BIND_LEXICAL                                             ~5, !1
   18     5        SEND_VAL                                                 ~5
   19     6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $6      
   15     8        ASSIGN                                                   !2, $6
   22     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
   23    12      > EXIT                                                     
   24    13*     > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FhcMLQ%3A16%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hcMLQ
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $name, !1 = $doctypes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   17     2        INIT_FCALL                                               'in_array'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6      > JMPZ                                                     $2, ->9
          7    >   QM_ASSIGN                                        ~3      !0
          8      > JMP                                                      ->10
          9    >   QM_ASSIGN                                        ~3      null
         10    > > RETURN                                                   ~3
   18    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FhcMLQ%3A16%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.39 ms | 1396 KiB | 19 Q