 <pre><code>echo sprintf('-%u',abs(-123)); </code></pre> <p>or</p> <pre><code>$n = -123; echo sprintf("%s%u", $n &lt; 0 ? "-":"", abs($n)); </code></pre> <p>Though if you actually want to see the two's complement unsigned value of a negative number restricted to 32 bits just do:</p> <pre><code>echo sprintf("%u", $n &amp; 0xffffffff); </code></pre> <p>And that will print <code>4294967173</code> on all systems.</p>