 <p>Why would you type an </p> <pre><code>array('a' =&gt; 'val', 'a' =&gt; 'val2') </code></pre> <p>in the first place?</p> <p>2nd question: use <code>bin2hex</code>: <a href="http://php.net/bin2hex" rel="nofollow">http://php.net/bin2hex</a></p>