3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result = array(); $list = array( 0 => array( "rut" => "16.534.770-6", "nombre" => "Miguel Pichipillán S", "fecha" => "25/08/2015", "estado" => "M/Ent", "count_ent" => 0, "count_sal" => 0 ), 1 => array( "rut" => "16.534.770-6", "nombre" => "Miguel Pichipillán S", "fecha" => "25/08/2015", "estado" => "M/Sal", "count_ent" => 0, "count_sal" => 0 ), 2 => array( "rut" => "16.534.770-6", "nombre" => "Miguel Pichipillán S", "fecha" => "26/08/2015", "estado" => "M/Ent", "count_ent" => 0, "count_sal" => 0 ), 3 => array( "rut" => "16.534.770-6", "nombre" => "Miguel Pichipillán S", "fecha" => "26/08/2015", "estado" => "M/Sal", "count_ent" => 0, "count_sal" => 0 ), 4 => array( "rut" => "16.534.770-6", "nombre" => "Miguel Pichipillán S", "fecha" => "26/08/2015", "estado" => "M/Ent", "count_ent" => 0, "count_sal" => 0 ), 5 => array( "rut" => "16.534.770-6", "nombre" => "Miguel Pichipillán S", "fecha" => "26/08/2015", "estado" => "M/Sal", "count_ent" => 0, "count_sal" => 0 ), 22 => array( "rut" => "16.534.770-6", "nombre" => "Miguel Pichipillán S", "fecha" => "02/09/2015", "estado" => "M/Ent", "count_ent" => 0, "count_sal" => 0 ), 23 => array( "rut" => "16.534.770-6", "nombre" => "Miguel Pichipillán S", "fecha" => "02/09/2015", "estado" => "M/Ent", "count_ent" => 0, "count_sal" => 0 ), 24 => array( "rut" => "16.534.770-6", "nombre" => "Miguel Pichipillán S", "fecha" => "02/09/2015", "estado" => "M/Ent", "count_ent" => 0, "count_sal" => 0 ), 25 => array( "rut" => "16.534.770-6", "nombre" => "Miguel Pichipillán S", "fecha" => "02/09/2015", "estado" => "M/Sal", "count_ent" => 0, "count_sal" => 0 ), ); foreach ($list as $key => $value) { $estado = $value["estado"]; $fecha = $value["fecha"]; unset($value["estado"]); if (!isset($result[$fecha])) { $result[$fecha] = $value; } if ($estado === "M/Sal") { $result[$fecha]["count_sal"]++; } if ($estado === "M/Ent") { $result[$fecha]["count_ent"]++; } } var_dump($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 26
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 26
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 25
Branch analysis from position: 20
Branch analysis from position: 15
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/B7rXR
function name:  (null)
number of ops:  31
compiled vars:  !0 = $result, !1 = $list, !2 = $value, !3 = $key, !4 = $estado, !5 = $fecha
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
   86     2      > FE_RESET_R                                       $8      !1, ->26
          3    > > FE_FETCH_R                                       ~9      $8, !2, ->26
          4    >   ASSIGN                                                   !3, ~9
   87     5        FETCH_DIM_R                                      ~11     !2, 'estado'
          6        ASSIGN                                                   !4, ~11
   88     7        FETCH_DIM_R                                      ~13     !2, 'fecha'
          8        ASSIGN                                                   !5, ~13
   90     9        UNSET_DIM                                                !2, 'estado'
   92    10        ISSET_ISEMPTY_DIM_OBJ                         0  ~15     !0, !5
         11        BOOL_NOT                                         ~16     ~15
         12      > JMPZ                                                     ~16, ->15
   93    13    >   ASSIGN_DIM                                               !0, !5
         14        OP_DATA                                                  !2
   96    15    >   IS_IDENTICAL                                             !4, 'M%2FSal'
         16      > JMPZ                                                     ~18, ->20
   97    17    >   FETCH_DIM_RW                                     $19     !0, !5
         18        FETCH_DIM_RW                                     $20     $19, 'count_sal'
         19        PRE_INC                                                  $20
  100    20    >   IS_IDENTICAL                                             !4, 'M%2FEnt'
         21      > JMPZ                                                     ~22, ->25
  101    22    >   FETCH_DIM_RW                                     $23     !0, !5
         23        FETCH_DIM_RW                                     $24     $23, 'count_ent'
         24        PRE_INC                                                  $24
   86    25    > > JMP                                                      ->3
         26    >   FE_FREE                                                  $8
  105    27        INIT_FCALL                                               'var_dump'
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.96 ms | 1396 KiB | 15 Q