substr

 

Kurzbeschreibung

Gibt einen Teil eines Strings zurück.

Funktionsbeschreibung

substr( string $_string , int $_start , int $_length ) : string

Beispiele

{% $_rest = substr("abcdef", 0, -1) %} {# returns "abcde" #} {% $_rest = substr("abcdef", 2, -1) %} {# returns "cde" #} {% $_rest = substr("abcdef", 4, -4) %} {# returns false #} {% $_rest = substr("abcdef", -3, -1) %} {# returns "de" #} {% $_rest = substr("abcdef", -1) %} {# returns "f" #} {% $_rest = substr("abcdef", -2) %} {# returns "ef" #} {% $_rest = substr("abcdef", -3, 1) %} {# returns "d" #}
Nach oben