I have been trying to shorten this code:
if(empty($soort))
{
    $error = 'ja';
    $error_soort = 'ja';
    $error_omschr_soort = $lang['error_no_entry'];
}
if(empty($klant_id))
{
    $error = 'ja';
    $error_klant_id = 'ja';
    $error_omschr_klant_id = $lang['error_no_entry'];
}
if(empty($contact_id))
{
    $error = 'ja';
    $error_contact_id = 'ja';
    $error_omschr_contact_id = $lang['error_no_entry'];
}
if(empty($aflever_id))
{
    $error = 'ja';
    $error_aflever_id = 'ja';
    $error_omschr_aflever_id = $lang['error_no_entry'];
}
if(empty($klant_ref))
{
    $error = 'ja';
    $error_klant_ref = 'ja';
    $error_omschr_klant_ref = $lang['error_no_entry'];
}
if(empty($materiaal))
{
    $error = 'ja';
    $error_materiaal = 'ja';
    $error_omschr_materiaal = $lang['error_no_entry'];
}
if(empty($dikte))
{
    $error = 'ja';
    $error_dikte = 'ja';
    $error_omschr_dikte = $lang['error_no_entry'];
}
To this much shorted code:
$check_empty = array($soort, $klant_id, $contact_id, $aflever_id, $klant_ref, $materiaal, $dikte);
foreach ($check_empty as $check)
{
    if(empty($check))
    {
        $error = 'ja';
        $error_check = 'ja';
        $error_omschr_check = $lang['error_no_entry'];
    }
}
The new code is not working. It seems (of course(?)) because if any of the values I want to check if they are empty they are not put in the array since an array can not hold empty values?
How can I make the original code shorter?



'ja'as a boolean TRUE?$foo = array('');. It is an array containing an empty string. What is that is not working? What should happen? What happens?