Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
17 lines (13 sloc) 260 Bytes
<?php
$array = [1,2,4,null,5];
foreach($array as $elem){
if($elem !== null){
//do something
}
}
//****************** Refactoring ***************************
$array = [1,2,4,null,5];
array_filter($array);
foreach($array as $elem){
//do something
}
You can’t perform that action at this time.