Changing Objects

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
Mr. Tech
Forum Contributor
Posts: 205
Joined: Tue Feb 11, 2003 4:18 pm
Location: Australia

Changing Objects

Post by Mr. Tech »

Hi!

I'm trying to change this:

$path = "|O|Dir1|O|Dir2|O|Dir3

To:

../../../

Using PHP. I tried using this but it doesn't seem to work:

$howfar = eregi_replace("\|O|([a-z0-9\|]+)", "../", $path);

Any help?
pootergeist
Forum Contributor
Posts: 273
Joined: Thu Feb 27, 2003 7:22 am
Location: UK

Post by pootergeist »

$dirs = explode("|0|",$path);
$new_path = '';
foreach($dirs AS $dir)
{
$new_path = $dir .'/';
}

that sort of thing?
Post Reply