All pastes #105912 Raw Edit

TacoTrailer

public text v1 · immutable
#105912 ·published 2006-07-30 00:08 UTC
rendered paste body
function createCrazyText ($text) {

global $html; //Globals are kewl

$textLenght = strlen($text); //Counts the lenght of the text
$textArray = array();	 // Creates array to put letters in later
$fontStyles = array('Arial', 'Verdana', 'Arial Black', 'Courier', 'Comic Sans MS', 'Times New Roman', 'Helvetica', 'Garamond'); //Fonts, you can add to this list 
$hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); //Array of hexes for the colors

	for ($i = 0; $i < $textLenght; $i++) {
	$textArray[$i] = $text{$i}; // Splits all text into $textArray 
	 }
 $i = 0;
 foreach ($textArray as $print) { 
 if($print != ' '){ // For every letter that's not a space
 
 if(rand(0,4) == 0){ // Will keep colored letters vs black to 1/5 ratio (estetic purpose)
 $color = ''; // Resets $color
 for ($i = 0; $i < 6; $i++) { //Adds 6 values to $color between 0 => F to proudce a standard hexidecimal color id
 $color.= $hex[rand(0, count($hex)-1)];
							 }
 } else {$color = '000000';} 
 
  	$fontSize = rand(12, 48); // Font sizes
	$fontFamily = $fontStyles[rand(0, count($fontStyles)-1)]; //Font families from the $fontFamily array
	$c++;
   print '<span style="font-size:'.$fontSize.'px; font-family:'.$fontFamily.'; color:#'.$color.';">'.$print.'</span>'; //Prints text
   $html.='<span style="font-size:'.$fontSize.'px; font-family:'.$fontFamily.'; color:#'.$color.';">'.$print.'</span>'; //Stores html
   //color:#'.$fontColors[rand(0, count($fontColors))].'

  } else {print ' ';}
}