All pastes #537789 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-06-04 21:07 UTC
rendered paste body
<?php

function hmm ($text, $start = 0, $max_len = 300)
{
	$array = explode(' ', substr($text, $start));
	$len = 0;
	$out = array();
	foreach ($array as $chunk)
	{
		$chunklen = strlen($chunk);
		if ($len + $chunklen <= $max_len)
		{
			$len += $chunklen;
			$out []= $chunk;
		}
		else
		{
			break;
		}
	}
	return implode(' ', $out);
}

echo hmm($text);

?>