Print random part of body
here you go: :)

$length = 50;

// strip html tags from body
$body = strip_tags($data-&gt;body);

// check that the body's actually longer than your snippet length
if (strlen($body) &lt;= $length) {
  return $body;
}
else {

  // find a random starting point between the beginning and 50 chars from the end
  $max = strlen($body) - $length;
  $start = rand(0, $max);

  // set ellipsis variables
  $prefix = $start ? '...' : '';
  $suffix = ($start == $max) ? '' : '...';

  return $prefix . substr($body, $start, $length) . $suffix;
}