Skip if field is empty

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Re: Skip if field is empty

Post by infolock »

Code: Select all

 
 
// if it's inside an array loop:
if(empty($address['postcode'])) {
  continue;
} else {
  $postcode = zen_output_string_protected($address['postcode']);
}
 
//if it's just a basic check:
$postcode = '';
if(!empty($address['postcode'])) {
  $postcode = zen_output_string_protected($address['postcode']);
}
 
 
Post Reply