Новая фича с хэлперами

This commit is contained in:
Maksym 2023-01-18 12:51:33 +01:00
parent 3f579afaed
commit 328e7483cd

View File

@ -0,0 +1,11 @@
<?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));
}
}