<?php $str = "{three/fifteen/one hundred} this is the first random number, and this is the second, {two/four}"; echo preg_replace_callback('~\{([^{}]*)}~', function ($x) { return array_rand(array_flip(explode('/', $x[1]))); }, $str);
You have javascript disabled. You will not be able to edit any code.