Gökhan BARAN
Full Stack Developer
© 2017-2024 All rights reserved.
Php rastgele kelime veya metin göstermek
Php rastgele kelime veya metin göstermek için dizi oluşturup rand ve count fonksiyonlarını kullanarak bir fonksiyon oluşturalım.
function random_color() {
$bs_color = array(
'warning',
'secondary',
'info');
$color = $bs_color[rand ( 0 , count($bs_color) -1)];
return $color;
}
echo random_color();