3v4l.org

run code in 300+ PHP versions simultaneously
<?php $source = [ [ "mail_id" => "29848947", "last_name" => "Doe", "first_name" => "Jon", "email" => "jdoe@gmail.com", "status" => "opened" ], [ "mail_id" => "340980398", "last_name" => "Doe", "first_name" => "Jane", "email" => "janedoe@gmail.com", "status" => "sent" ], [ "mail_id" => "877586", "last_name" => "Dwaye", "first_name" => "Jhon", "email" => "Jhondw@yahoo.com", "status" => "clicked" ], [ "mail_id" => "225253463", "last_name" => "Doe", "first_name" => "Jon", "email" => "jdoe@gmail.com", "status" => "opened" ], [ "mail_id" => "849849w4", "last_name" => "Doe", "first_name" => "Jane", "email" => "janedoe@gmail.com", "status" => "sent" ] ]; $result = array_values(array_reduce($source, function($carry, $event) { if(!array_key_exists($event['email'], $carry)) { $carry[$event['email']] = [ "first_name" => $event["first_name"], "last_name" => $event["last_name"], "email" => $event["email"], "opened" => 0, "blocked" => 0, "hard_bounced" => 0, "sent" => 0, "clicked" => 0 ]; } $carry[$event['email']][$event["status"]]++; return $carry; }, [])); print_r($result);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [first_name] => Jon [last_name] => Doe [email] => jdoe@gmail.com [opened] => 2 [blocked] => 0 [hard_bounced] => 0 [sent] => 0 [clicked] => 0 ) [1] => Array ( [first_name] => Jane [last_name] => Doe [email] => janedoe@gmail.com [opened] => 0 [blocked] => 0 [hard_bounced] => 0 [sent] => 2 [clicked] => 0 ) [2] => Array ( [first_name] => Jhon [last_name] => Dwaye [email] => Jhondw@yahoo.com [opened] => 0 [blocked] => 0 [hard_bounced] => 0 [sent] => 0 [clicked] => 1 ) )

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:
64.25 ms | 403 KiB | 8 Q