<?php if (isset($userInfo['user']['media']['nodes']) && is_array($userInfo['user']['media']['nodes']) && count($userInfo['user']['media']['nodes'])>0) { ?>
<?php foreach ($userInfo['user']['media']['nodes'] as $image) { ?>
<?php $i++; if ($i==10) break; ?>
<a href="https://www.instagram.com/p/<?= $image['code'] ?>/" target="_blank">
<img src="<?= $image['thumbnail_src'] ?>" class="img-responsive" alt="" />
</a>
<?php } ?>
<?php } ?>