alienhelpdesk.com
projects
Project London
The latest movie directed by Ian Hubert! And I get to help!
usefull sites
blender.org
Home of the blender foundation

chunk of text

This function cuts a string to a set length, and makes sure it doesn't cut a word in half.

  1. // Get a nicely sliced chunk of a text that doesn't cut a word in half.
  2. function getChunkOText($text, $length){
  3.  
  4.         $text = substr($text, 0, $length);
  5.         $spaced = false;
  6.         while((!$spaced) && $length){
  7.                 $length--;
  8.                 if(substr($text, -1) != ' '){
  9.                         $text = substr($text, 0, $length);
  10.                 }else{
  11.                         $text = substr($text, 0, $length);
  12.                         $spaced = true;
  13.                 }
  14.         }
  15.         return $text;
  16. }
Display clean php code for copying
// Get a nicely sliced chunk of a text that doesn't cut a word in half.
function getChunkOText($text, $length){

	$text = substr($text, 0, $length);
	$spaced = false;
	while((!$spaced) && $length){
		$length--;
		if(substr($text, -1) != ' '){
			$text = substr($text, 0, $length);
		}else{
			$text = substr($text, 0, $length);
			$spaced = true;
		}
	}
	return $text;
}
Spanish proverb
De noche todos los gatos son pardos
At night all cats are brown
Blender for dummies
Blender for Dummies
A brilliant book by Jason v Gumster
Essential Blender
Essential Blender
The official guide!