you want to remove all null value from an array without any loop. you can remove all null value from array without loop.I am explaining you, how to remove null value from an array. let’s see example how to remove null value :
<?php
$data = array(5000, "Azhar", null, "shaikh", NULL, "", 41, 457, 451);
$result = array_filter($data, function($section) {
return !is_null($section);
});
print_r($result);
?>
Result:
Array
(
[0] => 5000
[1] => Azhar
[3] => shaikh
[5] =>
[6] => 41
[7] => 457
[8] => 451
)
Hello, Welcome to webdeveloperindia.in. I am a full-stack web developer. Email – [email protected] | Skype – azaruddin23. I have knowledge of PHP, Laravel, Magento 1/2, Codeigniter, WordPress, Joomla, Shopify, Git, Bitbuket, jQuery, Ajax, Javascript and ReactJS.