Skip to content

Instantly share code, notes, and snippets.

function truncateString($str, $max, $rep = '...') {
if(strlen($str) > $max) {
$leave = $max - strlen($rep);
return substr_replace($str, $rep, $leave);
} else {
return $str;
}
}
@QuestionDevelopment
QuestionDevelopment / remove all returns
Created August 23, 2013 20:04
Gets rid of all types of hard spacing returns/tabs ect.
str_replace(array("\r\n", "\r", "\n", "\t"), "<br />", htmlentities(nl2br($hover_display)));
$message_to = "jcampo@quasars.com";
$message_from = "info@byf.com";
$message_subject = "Tax Reminders Test";
$message_body = $test_email;
$headers = 'From: '.$message_from. "\r\n" .
'Reply-To: '. $message_from . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($message_to, $message_subject, $message_body, $headers);
onmouseover="document.getElementById('id').style.display= 'block';" onmouseout="document.getElementById('id').style.display= 'none';"
cursor: hand; cursor: pointer;
overflow-y: scroll;
overflow-x: hidden;
<? if (basename($_SERVER["SCRIPT_FILENAME"]) == "index.htm"){ ?>
$pos = strpos($haystack,$needle);
if($pos === false) {
// string needle NOT found in haystack
}
else {
// string needle found in haystack
}
substr_replace($string ,"",-1);