这是我的代码:
$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