[ create a new paste ] login | about

Link: http://codepad.org/qp7XYHe4    [ raw code | output | fork ]

PHP, pasted on Jun 11:
1
2
3
4
5
6
7
<?
$text = "Welcome to [city]. I want [city] to be a random version each time. [city] should not be the same [city] each time.";

$keyword = "[city]";
$values = array("Orlando", "Dallas", "Atlanta", "Detroit", "Tampa", "Miami");

echo $result = str_replace($keyword, shuffle($values)?current($values):$values[0], $text);


Output:
1
Welcome to Tampa. I want Tampa to be a random version each time. Tampa should not be the same Tampa each time.


Create a new paste based on this one


Comments: