function interpolate($message, array $context = array())
    {
        // build a replacement array with braces around the context keys
        $replace = array();
        foreach ($context as $key => $val) {
            if ($key == "exception" && $val instanceof \Exception) {
                $replace['{' . $key . '}'] = $val->getMessage();
            } else {
                $replace['{' . $key . '}'] = $val;
            }
        }

        // interpolate replacement values into the message and return
        return strtr($message, $replace);
    }
function interpolate($message, array $context = array())
    {
        // build a replacement array with braces around the context keys
        $replace = array();
        foreach ($context as $key => $val) {
            if ($key == "exception" && $val instanceof \Exception) {
                $replace['{' . $key . '}'] = $val->getMessage();
            } else {
                $replace['{' . $key . '}'] = $val;
            }
        }

        // interpolate replacement values into the message and return
        return strtr($message, $replace);
    }
function interpolate ( $ message , array $ context = array ( ) ) { // build a replacement array with braces around the context keys $ replace = array ( ) ; foreach ( $ context as $ key => $ val ) { if ( $ key == "exception" && $ val instanceof \ Exception ) { $ replace [ '{' . $ key . '}' ] = $ val -> getMessage ( ) ; } else { $ replace [ '{' . $ key . '}' ] = $ val ; } } // interpolate replacement values into the message and return return strtr ( $ message , $ replace ) ; }
Implementation of Placeholder Interpolation
The message MAY contain placeholders which implementors MAY replace with values from the context array.
Placeholder names MUST correspond to keys in the context array.

@param string $message or an object with a __toString() method
@param array $context replacement values for placeholders
@return bool
Implementation of Placeholder Interpolation The message MAY contain placeholders which implementors MAY replace with values from the context array . Placeholder names MUST correspond to keys in the context array .