如何在数组中生成一个值,当随机选择时,会触发php脚本或页面其他地方的字体颜色更改


How do I make a value in an array, when selected randomly, trigger a php script or a font color change elsewhere in the page?

这是我的代码:

$extras = array(
    "No guitar solo",
    "One verse guitar solo",
    "Two verse guitar solo",
    "Guitar/vocals trade bars for a solo",
    "One verse vocal improv",
    "Roll a fourth verse"
);
echo $extras[array_rand($extras, 1)];

如果"Roll a fourth verse"是输出中随机选择的值,我需要它在页面稍后运行几个php echo命令。。。或者至少更改页面后面一行文本的字体颜色。

$extras = array(
    "No guitar solo",
    "One verse guitar solo",
    "Two verse guitar solo",
    "Guitar/vocals trade bars for a solo",
    "One verse vocal improv",
    "Roll a fourth verse"
);
$selected=$extras[array_rand($extras, 1)]; //assign the selected to a variable
if($selected=='Roll a fourth verse'){ //compare that variable to a string if it matches the string ...
//do XXXX
}//end match