private function clean(string $string, bool $space_remove = true)
    {
        $string = trim($string);
        if ($space_remove) {
            $string = str_replace(' ', '-', $string);
        }
        return preg_replace('/[^A-Za-z0-9\-][_]/', '', $string);
    }
private function clean(string $string, bool $space_remove = true)
    {
        $string = trim($string);
        if ($space_remove) {
            $string = str_replace(' ', '-', $string);
        }
        return preg_replace('/[^A-Za-z0-9\-][_]/', '', $string);
    }
private function clean ( string $ string , bool $ space_remove = true ) { $ string = trim ( $ string ) ; if ( $ space_remove ) { $ string = str_replace ( ' ' , '-' , $ string ) ; } return preg_replace ( '/[^A-Za-z0-9\-][_]/' , '' , $ string ) ; }
Clean a string
@param string $string String value
@param bool $space_remove Remove space (default set true)
@return null|string|string[]
Clean a string