Simplify a Fraction
<p>How can I simplify a fraction in PHP?</p>

<p>For instance, converting <code>40/100</code> to <code>2/5</code>.</p>

<p>The only way I could think of is to do a prime factorization on both numbers and compare like results, but I'm not really sure how to do that either.</p>
