Array_rand value dönmez, key döner.
Şu satırı
$hammetin = str_replace("toka",$degiscek,$bolunmus);Şununla değişin
$hammetin = str_replace("toka",$toka[$degiscek],$bolunmus);
hocam öncelikle ilginizden dolayı teşekkür ederim ama dediğiniz gibi yaptım olmadı az önce sorunu çözdüm şu şekilde olucak bilmeyenlerde görmüş olur
$urunler="toka asa mobcik neo hadi canım";
$bolunmus=explode(" ",$urunler);
$toka=array("loka","hoka","poka","koka");
$d=$toka[array_rand($toka)];
if (in_array ("toka", $bolunmus)):
$hammetin = str_replace("toka",$d,$bolunmus);
print_r ($hammetin);
endif;