3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [10, 20, 20, 10, 10, 30, 50, 10, 20]; $n = 9; $temp = array_count_values($arr); // count number of occurences $e = array_reduce($temp, function ($carry, $item) { $carry += ($item > 1 ? intval($item / 2) : 0); return $carry; }); echo $e;die;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/C5EUX
function name:  (null)
number of ops:  15
compiled vars:  !0 = $arr, !1 = $n, !2 = $temp, !3 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, 9
    4     2        INIT_FCALL                                               'array_count_values'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !2, $6
    5     6        INIT_FCALL                                               'array_reduce'
          7        SEND_VAR                                                 !2
          8        DECLARE_LAMBDA_FUNCTION                          ~8      [0]
    8     9        SEND_VAL                                                 ~8
    5    10        DO_ICALL                                         $9      
         11        ASSIGN                                                   !3, $9
    9    12        ECHO                                                     !3
         13      > EXIT                                                     
   10    14*     > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C5EUX
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $carry, !1 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        IS_SMALLER                                               1, !1
          3      > JMPZ                                                     ~2, ->8
          4    >   DIV                                              ~3      !1, 2
          5        CAST                                          4  ~4      ~3
          6        QM_ASSIGN                                        ~5      ~4
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~5      0
          9    >   ASSIGN_OP                                     1          !0, ~5
    7    10      > RETURN                                                   !0
    8    11*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.48 ms | 1012 KiB | 15 Q