<?php echo '<img src="'.isset(json_decode($child->params)->image) ? json_decode($child->params)->image : '' . '" />'; ?>
$your_friends = [12, 333, 7654, 987, 3456, 962, 150]; // твои друзья
$friends_your_friend = [1444, 973, 54, 987, 3456, 92, 4900]; // чужие друзья
$mutual_friends = array_intersect($your_friends, $friends_your_friend); // [ 987, 3456]
$sql = 'select * from `friends` where id_user in('.implode(',',$mutual_friends).')';