Standard Palindrome in PHP

Standard Palindrome in PHPA Standard Palindrome is a word or phrase that is the same forward as it is backwards without punctuation and spaces. So here is a small script that strips everything but letters and numbers in a string and finds if it’s a palindrome.

Read More

Limit Length of Text in PHP

Ok say you have a title like this:
“This is a long title for a story this is a title wow.”
And you want to have a excerpt from it.
Such as “This is a long title” instead of the whole thing

We would use the PHP substr function, which goes like this.
<?
$test = "your text here adding length here";
echo "".substr($test, 0, 25)."";
?>
$test is the text to clip, the 0 is where is starts in the phrase (0 makes it the beginning), while 25 is the amount of letter to clip.

This would make it say “your text here adding len”.

Then you could add to the end off the echo a …
like this:
echo "".substr($test, 0, 25)."...";

Read More