function rand_color($color_array) { $color = dechex(rand(3355443,13421772)); if (in_array($color, $color_array)) { $color = rand_color($color_array); } return $color; }