public static function sanitizeJsVarName($str)
    {
        $out = preg_replace("/ /", '_', trim($str));
        $out = preg_replace("/[^A-Za-z_]/", '', $out);

        return $out;
    }
public static function sanitizeJsVarName($str)
    {
        $out = preg_replace("/ /", '_', trim($str));
        $out = preg_replace("/[^A-Za-z_]/", '', $out);

        return $out;
    }
public static function sanitizeJsVarName ( $ str ) { $ out = preg_replace ( "/ /" , '_' , trim ( $ str ) ) ; $ out = preg_replace ( "/[^A-Za-z_]/" , '' , $ out ) ; return $ out ; }
Turn an arbitrary string into a usable javascript variable name

@param string $str The string to sanitize

@return string The sanitized string
Turn an arbitrary string into a usable javascript variable name