My script outputs an array:
$person = array( 'name' => 'bob', 'age' => '27', 'sex' => 'male', 'weight' => 'fat'
Sometimes the keys in $person have no meaning - and I want to check it. However, I don't give the chicken nugget about $person['age'] or $person['weight'] , I just want to check that the other keys in the array are not empty:
foreach ($person as $key => $value) { if ( $key != 'age' || $key != 'weight' ) { if ( empty($value) ) { echo 'you dun goofed'; } } }
Why is this not working?
source share