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"]++; } } foreach ($result as $k => $v) { if ($v["count_ent"] === 2 && $v["count_sal"] === 2) { continue; } unset ($result[$k]); } 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
2 jumps found. (Code = 77) Position 1 = 28, Position 2 = 40
Branch analysis from position: 28
2 jumps found. (Code = 78) Position 1 = 29, Position 2 = 40
Branch analysis from position: 29
2 jumps found. (Code = 46) Position 1 = 33, Position 2 = 36
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 38
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 36
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
Branch analysis from position: 26
filename:       /in/ap8fa
function name:  (null)
number of ops:  45
compiled vars:  !0 = $result, !1 = $list, !2 = $value, !3 = $key, !4 = $estado, !5 = $fecha, !6 = $v, !7 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
   87     2      > FE_RESET_R                                       $10     !1, ->26
          3    > > FE_FETCH_R                                       ~11     $10, !2, ->26
          4    >   ASSIGN                                                   !3, ~11
   88     5        FETCH_DIM_R                                      ~13     !2, 'estado'
          6        ASSIGN                                                   !4, ~13
   89     7        FETCH_DIM_R                                      ~15     !2, 'fecha'
          8        ASSIGN                                                   !5, ~15
   91     9        UNSET_DIM                                                !2, 'estado'
   93    10        ISSET_ISEMPTY_DIM_OBJ                         0  ~17     !0, !5
         11        BOOL_NOT                                         ~18     ~17
         12      > JMPZ                                                     ~18, ->15
   94    13    >   ASSIGN_DIM                                               !0, !5
         14        OP_DATA                                                  !2
   97    15    >   IS_IDENTICAL                                             !4, 'M%2FSal'
         16      > JMPZ                                                     ~20, ->20
   98    17    >   FETCH_DIM_RW                                     $21     !0, !5
         18        FETCH_DIM_RW                                     $22     $21, 'count_sal'
         19        PRE_INC                                                  $22
  101    20    >   IS_IDENTICAL                                             !4, 'M%2FEnt'
         21      > JMPZ                                                     ~24, ->25
  102    22    >   FETCH_DIM_RW                                     $25     !0, !5
         23        FETCH_DIM_RW                                     $26     $25, 'count_ent'
         24        PRE_INC                                                  $26
   87    25    > > JMP                                                      ->3
         26    >   FE_FREE                                                  $10
  106    27      > FE_RESET_R                                       $28     !0, ->40
         28    > > FE_FETCH_R                                       ~29     $28, !6, ->40
         29    >   ASSIGN                                                   !7, ~29
  107    30        FETCH_DIM_R                                      ~31     !6, 'count_ent'
         31        IS_IDENTICAL                                     ~32     ~31, 2
         32      > JMPZ_EX                                          ~32     ~32, ->36
         33    >   FETCH_DIM_R                                      ~33     !6, 'count_sal'
         34        IS_IDENTICAL                                     ~34     ~33, 2
         35        BOOL                                             ~32     ~34
         36    > > JMPZ                                                     ~32, ->38
  108    37    > > JMP                                                      ->28
  110    38    >   UNSET_DIM                                                !0, !7
  106    39      > JMP                                                      ->28
         40    >   FE_FREE                                                  $28
  113    41        INIT_FCALL                                               'var_dump'
         42        SEND_VAR                                                 !0
         43        DO_ICALL                                                 
         44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.08 ms | 1400 KiB | 15 Q