正規表現でマッチ箇所をランダムに置換
<?php public function hoge() { print preg_replace_callback($pattern, array($this, 'fuga'), $subject); } private function fuga($matches) { return $this->array[ array_rand($this->array, 1) ]; }
<?php public function hoge() { print preg_replace_callback($pattern, array($this, 'fuga'), $subject); } private function fuga($matches) { return $this->array[ array_rand($this->array, 1) ]; }