- array_intersect_key: documentation ( source)
<?php
$data = ['title' => 'The Title', 'type' => 'Movie', 'hour' => '', 'dayoftheweek' => 5, 'dayofthemonth' => ''];
$whitelist = ['title' => '', 'type' => ''];
$filtered = array_intersect_key($data, $whitelist);
// var_export($filtered); // uncomment if you want to see what remains
foreach($filtered as $key => $value) {
echo "<div class=\"col-md-4\">\n";
echo "\t<div class=\"name-value\" id=\"$key\">$value</div>\n";
echo "</div>\n";
}