Answers for "generate random color php"

PHP
1

generate random unique hex color code using php

echo '#' . substr(str_shuffle('ABCDEF0123456789'), 0, 6);
Posted by: Guest on July-12-2021
0

randhex php

function random_part() {
    return str_pad( dechex( mt_rand( 0, 255 ) ), 2, '0', STR_PAD_LEFT);
}

function randomHEX($amount) {
  $_result = "";
  for ($i = 0 ; $i < $amount; $i++) {
    $_result .= random_part();
  }
  return $_result;
}

//to get a 16 HEX number
echo randomHEX(8);
Posted by: Guest on November-10-2020

Code answers related to "generate random color php"

Browse Popular Code Answers by Language