Page 1 of 1

limiting an echo

Posted: Thu Apr 20, 2006 9:22 am
by elecktricity
Hey I was wondering if this was possible, I had like a variable with 25 characters and I only wanted to display the first 5 characters?

Posted: Thu Apr 20, 2006 9:28 am
by JayBird

Code: Select all

$string = "This is a string that might have 25 characters or so";

echo substr($string, 0, 5);

// outputs: This