1 <?php
2 $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
3 for ( $i = 0; $i < 8; $i++ )
4 echo $chars{ rand(0, strlen($chars)-1) };