Jump to content

[SOLVED] Remove everything after the last "/"?


aximbigfan

Recommended Posts

Darn, it's not working.

 

Here's my code. The idea is that I have a path like this,

aaaa/bbb/ccc

 

I want to rename ccc to something else. So I wanted to use the code I requested ot get the path before ccc, so I could append the new name for ccc on to it, and rename it there.

 

SNIP....		
{
		$old_new = substr($dir, 0, strpos($dir, '/'));
		$path_old = $this->opt_regd . $dir;
		$path_new = $this->opt_regd . $old_new . $new;
}
if (!rename($path_old, $path_new))
/SNIP...

 

EDIT: I'm an idiot. I missed that extra "r". I'll blame it on my laptop keyboard. Clearly I typed it, but the keyboard dropped it.

 

Thanks!

 

Thanks,

Chris

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.