limiting an echo

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
elecktricity
Forum Contributor
Posts: 128
Joined: Sun Sep 25, 2005 8:57 pm
Location: Trapped in my own little world.
Contact:

limiting an echo

Post 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?
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Code: Select all

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

echo substr($string, 0, 5);

// outputs: This
Post Reply