Skip to content

Instantly share code, notes, and snippets.

@AdamMadrzejewski
Created January 12, 2016 14:05
Show Gist options
  • Save AdamMadrzejewski/1a665e6c1a53e402f1ee to your computer and use it in GitHub Desktop.
Save AdamMadrzejewski/1a665e6c1a53e402f1ee to your computer and use it in GitHub Desktop.
Short text by whole words + '...'. Super simple.
<?php
if (strlen($property->pro_name) > 75)
{
$propertyName = implode(" ", explode( "\n", wordwrap($property->pro_name, 75))).'...';
}
else
{
$propertyName = $property->pro_name;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment