Shorten the amount of characters in a variable...


#1

Hey,

What I need to be able to do is delete characters off the end of a variable’s value until it is a certain minimum amount of characters, and then add a “…”. So if I made the character limit be 7 and if i mad e the variable value “PointlessThings”, “PointlessThings” would be shortened to “Pointle…”

Thanks,

Nick


#2

have you checked out the string functions … specifically substr_replace.

http://www.php.net/manual/en/function.s … eplace.php


#3

Thank you so much! I got it all working…

One other question I have related to this:

Is there any way I can just get a character count of a variable, like just have it display the amount of characters in a variable. So if the variable value was “PointlessThings”, the character count would display 15.

-Nick


#4

here you will find all the string functions -
http://www.php.net/manual/en/ref.strings.php

You will find what you are looking for there.