Here is what I currently have:
$spin = get_string_between($body, "{{{", "}}}");
$spin = explode("|", $spin);
shuffle($spin);
$spun = $spin[0];
$body = str_replace("{{{", "$spun", $body);
$body = str_replace("}}}", "", $body);
echo $body;
but rather than placing a random item from the array into $body, it places the whole array with the | still in it.
If I do print_r($spin[0]) it displays one random item from the array the way it should.
Does this make any sense? What am I doing wrong?
$spin = get_string_between($body, "{{{", "}}}");
$spin = explode("|", $spin);
shuffle($spin);
$spun = $spin[0];
$body = str_replace("{{{", "$spun", $body);
$body = str_replace("}}}", "", $body);
echo $body;
but rather than placing a random item from the array into $body, it places the whole array with the | still in it.
If I do print_r($spin[0]) it displays one random item from the array the way it should.
Does this make any sense? What am I doing wrong?