3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = Array ( 0 => Array ( 'id' => 671, 'title' => 'BIEND', 'img' => '', 'ville' => 'marseille' ) , 1 => Array ( 'id' => 670, 'title' => 'BIENC', 'img' => '', 'ville' => 'avignon' ) , 2 => Array ( 'id' => 669, 'title' => 'BIENB', 'img' => '', 'ville' => 'avignon' ) ); $result = array_reduce($data, function(&$cur, $x) { $cur[$x['ville']] = isset($cur[$x['ville']])?$cur[$x['ville']]+1:1; return $cur; }, []); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oeRBd
function name:  (null)
number of ops:  12
compiled vars:  !0 = $data, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   31     1        INIT_FCALL                                               'array_reduce'
          2        SEND_VAR                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FoeRBd%3A31%240'
   35     4        SEND_VAL                                                 ~3
          5        SEND_VAL                                                 <array>
          6        DO_ICALL                                         $4      
   31     7        ASSIGN                                                   !1, $4
   36     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FoeRBd%3A31%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oeRBd
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $cur, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   33     2        FETCH_DIM_R                                      ~2      !1, 'ville'
          3        FETCH_DIM_R                                      ~4      !1, 'ville'
          4        ISSET_ISEMPTY_DIM_OBJ                         0          !0, ~4
          5      > JMPZ                                                     ~5, ->11
          6    >   FETCH_DIM_R                                      ~6      !1, 'ville'
          7        FETCH_DIM_R                                      ~7      !0, ~6
          8        ADD                                              ~8      ~7, 1
          9        QM_ASSIGN                                        ~9      ~8
         10      > JMP                                                      ->12
         11    >   QM_ASSIGN                                        ~9      1
         12    >   ASSIGN_DIM                                               !0, ~2
         13        OP_DATA                                                  ~9
   34    14      > RETURN                                                   !0
   35    15*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FoeRBd%3A31%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.8 ms | 1396 KiB | 17 Q