3v4l.org

run code in 300+ PHP versions simultaneously
<?php $default = ['c2'=>0,'c3'=>0,'c4'=>0,'c5'=>0]; $years = [7,8,9]; $students = [ 20=>7, 21=>11, 420=>8, 52=>12, 55=>9 ]; $students = array_filter($students, function($year) use ($years) { return in_array($year, $years); }); $totals = array_fill_keys(array_keys($students), $default); print_r($totals);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c0LiP
function name:  (null)
number of ops:  22
compiled vars:  !0 = $default, !1 = $years, !2 = $students, !3 = $totals
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, <array>
   14     3        INIT_FCALL                                               'array_filter'
          4        SEND_VAR                                                 !2
          5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fc0LiP%3A14%240'
          6        BIND_LEXICAL                                             ~7, !1
   16     7        SEND_VAL                                                 ~7
          8        DO_ICALL                                         $8      
   14     9        ASSIGN                                                   !2, $8
   18    10        INIT_FCALL                                               'array_fill_keys'
         11        INIT_FCALL                                               'array_keys'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $10     
         14        SEND_VAR                                                 $10
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $11     
         17        ASSIGN                                                   !3, $11
   19    18        INIT_FCALL                                               'print_r'
         19        SEND_VAR                                                 !3
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fc0LiP%3A14%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c0LiP
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $year, !1 = $years
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   15     2        INIT_FCALL                                               'in_array'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
   16     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fc0LiP%3A14%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.27 ms | 1396 KiB | 23 Q