Anonymous
public text v1 · immutable<?php
function wordlength($txt, $limit)
{
$words = explode(' ', $txt);
foreach($words as $v)
{
if(strlen($v) > $limit)
{
return false;
}
}
return true;
}
?>
Uses like this:
<?php
$txt = "Onelongword and some small ones";
if(!wordlength($txt, 10))
{
die("One of the words where too long");
}