3v4l.org

run code in 300+ PHP versions simultaneously
<?php $attachmentSizes = array('Galeria', 'Rss', 'Grande', 'Mediana'); $fotos = array(array('idAdjunto' => 1, 'tamano' => 'Grande'), array('idAdjunto' => 2, 'tamano'=>'Galeria'), array('idAdjunto' => 3, 'tamano'=>'Mediana')); $foto = array_filter($fotos, function($foto, $i) { return in_array($foto['tamano'], $attachmentSizes); }); $media = array_filter($attachmentSizes, function($size, $i) use ($fotos){ return array_filter($fotos, function($arrAdjunto) use ($size) { if ($arrAdjunto['tamano'] == $size) { return $arrAdjunto; } }); }); var_dump($media); die;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/640B3
function name:  (null)
number of ops:  20
compiled vars:  !0 = $attachmentSizes, !1 = $fotos, !2 = $foto, !3 = $media
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'array_filter'
          3        SEND_VAR                                                 !1
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F640B3%3A6%240'
    8     5        SEND_VAL                                                 ~6
          6        DO_ICALL                                         $7      
    6     7        ASSIGN                                                   !2, $7
   10     8        INIT_FCALL                                               'array_filter'
          9        SEND_VAR                                                 !0
         10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F640B3%3A10%241'
         11        BIND_LEXICAL                                             ~9, !1
   16    12        SEND_VAL                                                 ~9
         13        DO_ICALL                                         $10     
   10    14        ASSIGN                                                   !3, $10
   18    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                                 
   19    18      > EXIT                                                     
         19*     > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F640B3%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/640B3
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $foto, !1 = $i, !2 = $attachmentSizes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'in_array'
          3        FETCH_DIM_R                                      ~3      !0, 'tamano'
          4        SEND_VAL                                                 ~3
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $4      
          7      > RETURN                                                   $4
    8     8*     > RETURN                                                   null

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

Function %00%7Bclosure%7D%2Fin%2F640B3%3A10%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/640B3
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $size, !1 = $i, !2 = $fotos
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   11     3        INIT_FCALL                                               'array_filter'
          4        SEND_VAR                                                 !2
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F640B3%3A11%242'
          6        BIND_LEXICAL                                             ~3, !0
   15     7        SEND_VAL                                                 ~3
          8        DO_ICALL                                         $4      
          9      > RETURN                                                   $4
   16    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F640B3%3A10%241

Function %00%7Bclosure%7D%2Fin%2F640B3%3A11%242:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/640B3
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $arrAdjunto, !1 = $size
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   12     2        FETCH_DIM_R                                      ~2      !0, 'tamano'
          3        IS_EQUAL                                                 !1, ~2
          4      > JMPZ                                                     ~3, ->6
   13     5    > > RETURN                                                   !0
   15     6    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F640B3%3A11%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.14 ms | 1400 KiB | 19 Q