Trim at position

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
ianhull
Forum Contributor
Posts: 310
Joined: Tue Jun 14, 2005 10:04 am
Location: Hull England UK

Trim at position

Post by ianhull »

Can anyone please hhelp me trim a string at a certain position

Thanks

Code: Select all


$thisServerLength = strlen($_SERVER['HTTP_HOST']);
trim($_SERVER['HTTP_REFERER']); //At Position $thisServerLength

User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

You need a preg_replace(). Take a look in our regex forum.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You actually appear to be looking for substr() ianhull. strpos() will likely be needed as well.
Post Reply