Reputation: 976
How do you remove certain characters from a file name and then display it?
For example let's say I have a photo album with the directory of localhost/images/gallery/This_Is_Album_1 and I want to echo the name of this directory but only as This Is Album 1. I downloaded a pre-existing image gallery script that makes albums without a database but in the examples the folder name has spaces in it. When it comes to directories I'd like to avoid spaces.
Is this at all possible? Even if someone could just point me to a tutorial I would be appreciative.
Upvotes: 0
Views: 83
Reputation: 381
You can use http://php.net/str_replace.
Assuming that the name you are trying to echo is in $name:
$name = str_replace("_", " ", $name);
Upvotes: 1