$sanitizersnakeCase()

Convert string to be all snake_case (lowercase and underscores)

For example, "Hello World" or "hello-world" becomes "hello_world".

Usage

// basic usage
$string = $sanitizer->snakeCase(string $value);

// usage with all arguments
$string = $sanitizer->snakeCase(string $value, array $options = []);

Arguments

NameType(s)Description
$valuestring
$options (optional)array
  • allow (string): Characters to allow or range of characters to allow, for placement in regex Default:'a-z0-9'
  • hyphen (string): Character to use as the hyphen Default:'-'

Return value

string


$sanitizer methods and properties

API reference based on ProcessWire core version 3.0.253