is_string

 

Kurzbeschreibung

Prüft, ob Variable vom Typ string ist.

Funktionsbeschreibung

is_string( mixed $_var ) : bool

Beispiele

{% $_array = [true, false, 'abc', '23', 23, '23.5', 23.5, '', ' ', '0', 0] %} {% for $_i in $_array %} {% if is_string($_i) %} $_i is a string <br /> {% else %} $_i is NOT a string <br /> {% endif %} {% endfor %} {# Outputs: 1 is NOT a string is NOT a string abc is a string 23 is a string 23 is NOT a string 23.5 is a string 23.5 is NOT a string is a string is a string 0 is a string 0 is NOT a string #}
Nach oben