<html><body bgcolor="#ffffff" text-"#000000">
<table border="1" align="center"><tr><td wudth="500">
<center><h2>MAKE AN ASCII VALENTINE HEART</h2></center>
Write your words into the textbox and they will form an ASCII heart. Words must be greater than 2 characters (can use spaces). You can CCP the heart and place it into a html page between <pre> and </pre> tags. You can change the font size and color too.<br><br>Ascii Heart codes adapted to php from javascript generated by: www.UniversalScraps.com and www.htmlorkut.com
</td></tr></table>
<form method="GET">Words:
<input type="text" name="string"><br>
<input type="submit" value="Make Heart"><br>
</form>
<font size="3" color="red">
<pre>
<?
if ($_REQUEST["string"]) {
$string = $_REQUEST["string"];
} else {
$string = "";
}
function truncate($string, $min, $max)
{
$num_char=strlen($string);
if ($num_char <= $max){
$newstring=str_repeat($string,7);
$num_char=strlen($newstring);
$cutstring=substr($newstring, $min, $max);
}
elseif ($num_char >= $max){
$cutstring=substr($string, $min, $max);
}
return $cutstring;
}
#1
echo "_________" . truncate($string, 0,8) . "____________" . truncate($string, 0,9) . "\n";
#2
echo "______" . truncate($string, 0,12) . "_______" . truncate($string, 0,15) . "\n";
#3
echo "____" . truncate($string, 0,17) . "___" . truncate($string, 0,17) . "\n";
#4
echo "___" . truncate($string, 0, 21) . truncate($string, 0,9) . "_______" . truncate($string, 0,4) . "\n";
#5
echo "__" . truncate($string, 0,21) . truncate($string, 0,9) . "_________" . truncate($string, 0,4) . "\n";
#6
echo "_" . truncate($string, 0,21) . truncate($string, 0,13) . "_______" . truncate($string, 0,4) . "\n";
#7
echo "_" . truncate($string, 0,21) . truncate($string, 0,17) . "______" . truncate($string, 0,1) . "\n";
#8
echo truncate($string, 0,21) . truncate($string, 0,20) . "__" . truncate($string, 0,3) . "\n";
#9
echo truncate($string, 0,21) . truncate($string, 0,21) . "_" . truncate($string, 0,3) . "\n";
#10
echo truncate($string, 0,21) . truncate($string, 0,21) . truncate($string, 0,4) . "\n";
#11
echo truncate($string, 0,21) . truncate($string, 0,21) . truncate($string, 0,3) . "\n";
#12
echo "_" . truncate($string, 0,21) . truncate($string, 0,21) . truncate($string, 0,1) . "\n";
#13
echo "__" . truncate($string, 0,21) . truncate($string, 0,20) . "\n";
#14
echo "____" . truncate($string, 0,21) . truncate($string, 0,17) . "\n";
#15
echo "______" . truncate($string, 0,21) . truncate($string, 0,13) . "\n";
#16
echo "_________" . truncate($string, 0,21) . truncate($string, 0,7) . "\n";
#17
echo "____________" . truncate($string, 0,21) . truncate($string, 0,1) . "\n";
#18
echo "______________" . truncate($string, 0,17) . "\n";
#19
echo "_________________" . truncate($string, 0,13) . "\n";
#20
echo "___________________" . truncate($string, 0,9) . "\n";
#21
echo "_____________________" . truncate($string, 0,6) . "\n";
#22
echo "______________________" . truncate($string, 0,4) . "\n";
#23
echo "_______________________" . truncate($string, 0,2) . "\n";
?>
</font>
</pre>
<h3 align="center">
<a href="http://www.lingolinda.com/script/ShowCode.php">PHP text file</a></h3>
</body></html>