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);
Output for git.master, git.master_jit, rfc.property-hooks
array(1) { ["26/08/2015"]=> array(5) { ["rut"]=> string(12) "16.534.770-6" ["nombre"]=> string(21) "Miguel Pichipillán S" ["fecha"]=> string(10) "26/08/2015" ["count_ent"]=> int(2) ["count_sal"]=> int(2) } }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
47.36 ms | 401 KiB | 8 Q