url_title($str, $separator = '-', $lowercase = FALSE)
Parameters: |
|
---|---|
Returns: |
URL-formatted string |
Return type: |
string |
Takes a string as input and creates a human-friendly URL string. This is useful if, for example, you have a blog in which you’d like to use the title of your entries in the URL. Example:
1 2 3 | $title = "What's wrong with CSS?" ; $url_title = url_title( $title ); // Produces: Whats-wrong-with-CSS |
The second parameter determines the word delimiter. By default dashes are used. Preferred options are: - (dash) or _ (underscore)
Example:
1 2 3 | $title = "What's wrong with CSS?" ; $url_title = url_title( $title , 'underscore' ); // Produces: Whats_wrong_with_CSS |
Note
Old usage of ‘dash’ and ‘underscore’ as the second parameter is DEPRECATED.
The third parameter determines whether or not lowercase characters are forced. By default they are not. Options are boolean TRUE/FALSE.
Example:
1 2 3 | $title = "What's wrong with CSS?" ; $url_title = url_title( $title , 'underscore' , TRUE); // Produces: whats_wrong_with_css |
Please login to continue.