Laravel 5 - Extract emails from array? -


i've looked around didn't find solution or way in laravel out of box, wondering if there way this:

i have $emails array, 2 emails valid , 1 invalid:

$emails = ["apple@fruits.com","banana@fruits.com","apple.com","banana"];  // how can following 2 arrays using laravel? $validemails = ["apple@fruits.com","banana@fruits.com"]; $invalidemails = ["apple.com","banana"]; 

how can last 2 arrays using laravel $emails array?

probably don't need laravel this.

$validemails = []; $invalidemails = []; foreach ($emails $email){    if (filter_var($email, filter_validate_email)) {          $validemails[] = $email;    }    else    {          $invalidemails[] = $email;    } } 

[note : work after php 5.2]


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -