How do I mail the error context? (Make a string of it)
<p>Consider the custom error fucntion:</p>

<pre><code>function customError($errNumber, $errString, $errFile, $errLine, $errContext)
</code></pre>

<p>The <code>$errContext</code> provides a lot of useful information to debug with. How can I put this into a string and mail it?</p>

<p><strong>My first attempt:</strong></p>

<pre><code>$mailContent = "Error \n";

foreach($errContext as $errType =&gt; $stringOrArray)
{
    $mailContent .= "\n$errType =&gt;";

    if(is_array($stringOrArray))
    {
        $mailContent .= " Array\n";

        foreach($stringOrArray as $key =&gt; $value)
        {
            $mailContent .= "\n            $key =&gt; $value"; 
        }

        $mailContent .= "\n";
    }

    else

        $mailContent .= " $stringOrArray";

}
</code></pre>

<ul>
<li>This does not work with objects (yet).</li>
<li>This is not very elegant.</li>
</ul>

<p>Is there an easy way that I do not know about?</p>

<p>Thanks in advance!</p>
