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_map(function($email) use($source) { $events = array_values(array_filter($source, function($event) use($email) { return $event['email'] == $email; })); return [ "first_name" => $events[0]["first_name"], "last_name" => $events[0]["last_name"], "email" => $email, "opened" => count(array_filter($events, function($event) { return $event["status"] == "opened"; })), "blocked" => count(array_filter($events, function($event) { return $event["status"] == "blocked"; })), "hard_bounced" => count(array_filter($events, function($event) { return $event["status"] == "hard_bounced"; })), "soft_bounced" => count(array_filter($events, function($event) { return $event["status"] == "soft_bounced"; })), "sent" => count(array_filter($events, function($event) { return $event["status"] == "sent"; })), "clicked" => count(array_filter($events, function($event) { return $event["status"] == "clicked"; })), ]; }, array_unique(array_column($source, "email"))); 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 [soft_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 [soft_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 [soft_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:
60.79 ms | 403 KiB | 8 Q