Method: str::shorturl
Shortens an URL
It removes http:// or https:// and uses str::short afterwards
Info
Syntax
str::shorturl($url, $chars=false, $base=false, $rep='…')
Parameters
- $url (string) The URL to be shortened
- $chars (int) The final number of characters the URL should have
- $base (boolean) True: only take the base of the URL.
- $rep (string) The element, which should be added if the string is too long. Ellipsis is the default.
Return (string)
The shortened URL
Example
echo str::shorturl('http://veryveryverylongurl.com', 30);
// output: veryveryverylongurl.com