11 lines
225 B
PHP
11 lines
225 B
PHP
|
<?php
|
||
|
|
||
|
namespace DarksLight2\Helpers;
|
||
|
|
||
|
class Str
|
||
|
{
|
||
|
public static function snakeCase($string): string
|
||
|
{
|
||
|
return strtolower(preg_replace(['/([a-z\d])([A-Z])/', '/([^_])([A-Z][a-z])/'], '$1_$2', $string));
|
||
|
}
|
||
|
}
|