This should work
<?php
require_once('instagram.php');
$app_key = '';
$instagram = new Instagram($app_key);
$media = $instagram->getTagMedia('cats');
$pattern = '/\d+\/+10/';
$fulldata = array();
if($media) {
do {
foreach ($media->data as $entry) {
$text = $entry->caption->text;
if(preg_match($pattern, $text)) {
$fulldata[] = $entry;
}
}
} while ($media = $instagram->pagination($media));
}
?>
<pre>
<? echo json_encode($fulldata); ?>
</pre>