How do I strip left character from a string

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
terrymechan
Forum Newbie
Posts: 2
Joined: Tue Apr 08, 2003 6:40 am

How do I strip left character from a string

Post by terrymechan »

I have

$image = "/upload/fred.jpg";

I want to strip the first charcter from $images so that $images becomes

"upload/fred.php";

What code should I use to do this
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

substr()[/php_man]

Code: Select all

substr($image,1)
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

or [php_man]ltrim[/php_man]()

Code: Select all

$trimmed = ltrim($image,"/");
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply