3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( array( "contact_name" => "contact1", "email" => "", "id" => 1 ), array( "contact_name" => "contact2", "email" => null, "id" => 2 ), array( "contact_name" => "contact3", "email" => "user@domain.com", "id" => 3 ), ); $filtered = array_filter($array, function($contact) { if(!empty($contact['email']) && $contact['email'] != '') { return $contact; } }); echo '<pre><code>', print_r($filtered), '</code></pre>';

preferences:
45.6 ms | 402 KiB | 5 Q