Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Convert spaces to dash and lowercase with PHP
The return value of strtolower can be passed as the third argument to str_replace (where $string is present). The str_replace function is used to replace a set of characters/character with a different set of character/string.
Example
$str = 'hello have a good day everyone';
echo str_replace(' ', '-', strtolower($str));
Output
This will produce the following output −
hello-have-a-good-day-everyone
Advertisements
