[SOLVED] How to filter or trim a vale?

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
Cateyes
Forum Commoner
Posts: 63
Joined: Mon Jun 14, 2004 5:06 pm

How to filter or trim a vale?

Post by Cateyes »

Hi I was wondering if there is a way to remove 2 periods from a value for example:
$ex="../dir/filename"
so that you could make it look like this:
$ex="/dir/filename"
I am positive there is a simple command and thought I read about in the forums here but can't seem to find it now.
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

Code: Select all

<?php
$ex = str_replace("..", "", "../dir/filename");
?>
read up on [php_man]str[/php_man] functions
Cateyes
Forum Commoner
Posts: 63
Joined: Mon Jun 14, 2004 5:06 pm

Post by Cateyes »

Thank you I know it was a simple code but couldn't remeber what it was.
Post Reply