- var_dump: documentation ( source)
- array_rand: documentation ( source)
- str_split: documentation ( source)
<?php
$random_string = function($length) {
$bag = str_split('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789');
$string = '';
while ($length--) {
$string .= $bag[array_rand($bag)];
}
return $string;
};
$client_id = $random_string(2);
var_dump($client_id);