How to add a suffix at the end of a string in PHP
Posted
by Golem
on Stack Overflow
See other posts from Stack Overflow
or by Golem
Published on 2010-03-18T16:42:44Z
Indexed on
2010/03/18
16:51 UTC
Read the original article
Hit count: 225
php
I am trying to add a .html suffix at the end of all strings supplied by the user before it is entered into the database. Here's my code so far:
strtolower(str_replace(" ", "_", $postTitle));
The above takes the title of the post the user it trying to make, turns it to lower case, replaces all white spaces with underscores and makes it ready to be entered into a database column called post_url.
I just need it to do one more thing and that's to add a .html at the end of each post url. What is the function to do this?
© Stack Overflow or respective owner