I have this situation

while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
          $images[] = [
               'image' => $row['image']
function image_html($image) {
      return '<img src="' . $image['image'] . '" class="img-responsive" />';

echo '<div class="small-box">            
         '. image_html($images[0]) .'
      <div class="small-box">            
         '. image_html($images[1]) .'

      // some more divs

Is it possible to check if there is no image_html($images[0]) to hide the <div class="small-box"> because right now I got empty box on the page?

Like this?

foreach ($images as $image)
    echo '<div class="small-box">' . image_html($image) . '</div>';

Thank's for the answer but I need to use my current source because I have different columns with different image size etc.
So along with small-box I have also medium-box and large-box.

p.s. I also don't see how your answer will hide( or place default image ) if there is no record in database table?

Correct, not hide, it doesn't display any. If you want to hide one:

$style = '';
if (!isset($images[0]))
    $style = ' style="display:hidden" ';

echo '<div class="small-box"' . $style . '>' . image_html($images[0]) . '</div>';

Is it possible to apply this to whole $images[] ... $images[0], $images[1].... and so on. I mean do I need to write something like:

if (!isset($images[0]) && !isset($images[1]) && !isset($images[1]) && !isset($images[N]))

or there is another solution?

if (count($images) == 0)

It's hard to answer without knowing the bigger picture.

I think what priteas is trying to get across to you is that you need to change your thinking.

Consider it this way: "only display the box when there are images to display."

That way, you are not trying to "fix" something post render or mid build.