$sanitizer->snakeCase() method

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.236

“We chose ProcessWire because of its excellent architecture, modular extensibility and the internal API. The CMS offers the necessary flexibility and performance for such a complex website like superbude.de. ProcessWire offers options that are only available for larger systems, such as Drupal, and allows a much slimmer development process.” —xport communication GmbH