protected function findCharset($struct)
    {
        if (isset($struct->parameters)) {
            foreach ($struct->parameters as $param) {
                if (strtolower($param->attribute) === 'charset') {
                    return strtoupper($param->value);
                }
            }
        }
        if (isset($struct->dparameters)) {
            foreach ($struct->dparameters as $param) {
                if (strtolower($param->attribute) === 'charset') {
                    return strtoupper($param->value);
                }
            }
        }

        return '';
    }
protected function findCharset($struct)
    {
        if (isset($struct->parameters)) {
            foreach ($struct->parameters as $param) {
                if (strtolower($param->attribute) === 'charset') {
                    return strtoupper($param->value);
                }
            }
        }
        if (isset($struct->dparameters)) {
            foreach ($struct->dparameters as $param) {
                if (strtolower($param->attribute) === 'charset') {
                    return strtoupper($param->value);
                }
            }
        }

        return '';
    }
protected function findCharset ( $ struct ) { if ( isset ( $ struct -> parameters ) ) { foreach ( $ struct -> parameters as $ param ) { if ( strtolower ( $ param -> attribute ) === 'charset' ) { return strtoupper ( $ param -> value ) ; } } } if ( isset ( $ struct -> dparameters ) ) { foreach ( $ struct -> dparameters as $ param ) { if ( strtolower ( $ param -> attribute ) === 'charset' ) { return strtoupper ( $ param -> value ) ; } } } return '' ; }
Locate the charset within the struct

@param  stdClass $struct
@return string
Locate the charset within the struct