Well, I know there was already a similar question before, but I think, this one is a bit different and/or specific. The following Code always returns the correct value-positions within my "$targetArray" (1,2,3,4,5,...), but not its value (*,::,:::,-,...).
function BlaBla($text, $chars = 40) {
$targetArray = array(" * ", " :: ", " ::: ", " - ", " # ", " ", " ", " ", " / ", " \\ ", " ++ ", " ~ ");
$rand = array_rand($targetArray);
$text = $text." ";
$text = substr($text,0,$chars);
$text = substr($text,0,strrpos($text,' '));
$text = $text." ".$rand;
return $text;
}
So: Where is the hook? Any hints for this?
When picking only one entry, array_rand() returns the __key__ for a random entry.