How to format text for URL pattern?
<?php
$australianbrother = "Long Life Australia";
The value has to come out in the pattern below
longi-life-australia
Thank you very much in advance
How to format text for URL pattern?
<?php
$australianbrother = "Long Life Australia";
The value has to come out in the pattern below
longi-life-australia
Thank you very much in advance
What is the real problem you are trying to solve?
The result is called a slug
. You can create a simple function yourself, but it can get quite hair when you get into different encodings etc. It’s easier to use something others have already created, like the
Slugger
in the Symfony String component.
See https://symfony.com/doc/current/components/string.html#slugger
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.