3v4l.org

run code in 300+ PHP versions simultaneously
<?php $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 = ["Orlando", "Dallas", "Atlanta", "Detroit", "Tampa", "Miami"]; shuffle($values); echo preg_replace_callback( '/' . preg_quote($keyword) . '/', function() use(&$values) { return array_pop($values); }, $text );
Output for 8.1.6
Welcome to Dallas. I want Detroit to be a random version each time. Miami should not be the same Tampa each time.
Output for 8.1.5
Welcome to Orlando. I want Dallas to be a random version each time. Atlanta should not be the same Tampa each time.
Output for 8.1.4
Welcome to Orlando. I want Miami to be a random version each time. Atlanta should not be the same Tampa each time.
Output for 8.1.3
Welcome to Tampa. I want Detroit to be a random version each time. Dallas should not be the same Miami each time.
Output for 8.1.2
Welcome to Dallas. I want Atlanta to be a random version each time. Orlando should not be the same Miami each time.
Output for 8.1.1
Welcome to Dallas. I want Tampa to be a random version each time. Atlanta should not be the same Detroit each time.
Output for 8.1.0
Welcome to Dallas. I want Orlando to be a random version each time. Atlanta should not be the same Detroit each time.
Output for 8.0.2, 8.0.19
Welcome to Atlanta. I want Miami to be a random version each time. Detroit should not be the same Dallas each time.
Output for 8.0.18
Welcome to Atlanta. I want Tampa to be a random version each time. Detroit should not be the same Dallas each time.
Output for 8.0.17
Welcome to Detroit. I want Orlando to be a random version each time. Dallas should not be the same Miami each time.
Output for 8.0.16
Welcome to Miami. I want Dallas to be a random version each time. Tampa should not be the same Detroit each time.
Output for 8.0.15
Welcome to Tampa. I want Atlanta to be a random version each time. Detroit should not be the same Dallas each time.
Output for 8.0.14
Welcome to Tampa. I want Dallas to be a random version each time. Miami should not be the same Atlanta each time.
Output for 8.0.13
Welcome to Atlanta. I want Miami to be a random version each time. Detroit should not be the same Tampa each time.
Output for 8.0.6, 8.0.12
Welcome to Tampa. I want Detroit to be a random version each time. Orlando should not be the same Atlanta each time.
Output for 8.0.11
Welcome to Orlando. I want Dallas to be a random version each time. Atlanta should not be the same Miami each time.
Output for 8.0.10
Welcome to Dallas. I want Orlando to be a random version each time. Miami should not be the same Atlanta each time.
Output for 8.0.9
Welcome to Tampa. I want Miami to be a random version each time. Atlanta should not be the same Dallas each time.
Output for 7.4.12, 8.0.8
Welcome to Miami. I want Orlando to be a random version each time. Atlanta should not be the same Tampa each time.
Output for 8.0.7
Welcome to Atlanta. I want Tampa to be a random version each time. Orlando should not be the same Dallas each time.
Output for 8.0.5
Welcome to Tampa. I want Atlanta to be a random version each time. Dallas should not be the same Detroit each time.
Output for 8.0.3
Welcome to Atlanta. I want Tampa to be a random version each time. Miami should not be the same Orlando each time.
Output for 8.0.1
Welcome to Tampa. I want Atlanta to be a random version each time. Dallas should not be the same Orlando each time.
Output for 7.4.29
Welcome to Tampa. I want Miami to be a random version each time. Dallas should not be the same Detroit each time.
Output for 7.4.28
Welcome to Detroit. I want Orlando to be a random version each time. Tampa should not be the same Miami each time.
Output for 7.4.27
Welcome to Atlanta. I want Detroit to be a random version each time. Tampa should not be the same Dallas each time.
Output for 7.4.26
Welcome to Detroit. I want Miami to be a random version each time. Orlando should not be the same Dallas each time.
Output for 7.4.25
Welcome to Tampa. I want Orlando to be a random version each time. Miami should not be the same Atlanta each time.
Output for 7.4.24
Welcome to Miami. I want Detroit to be a random version each time. Dallas should not be the same Tampa each time.
Output for 7.4.23
Welcome to Miami. I want Tampa to be a random version each time. Detroit should not be the same Orlando each time.
Output for 7.4.22
Welcome to Detroit. I want Tampa to be a random version each time. Orlando should not be the same Dallas each time.
Output for 7.4.21
Welcome to Detroit. I want Miami to be a random version each time. Dallas should not be the same Orlando each time.
Output for 7.4.20
Welcome to Dallas. I want Orlando to be a random version each time. Tampa should not be the same Atlanta each time.
Output for 7.4.19
Welcome to Orlando. I want Detroit to be a random version each time. Atlanta should not be the same Dallas each time.
Output for 7.4.18
Welcome to Dallas. I want Tampa to be a random version each time. Miami should not be the same Orlando each time.
Output for 7.4.16
Welcome to Atlanta. I want Tampa to be a random version each time. Dallas should not be the same Detroit each time.
Output for 7.4.15
Welcome to Miami. I want Tampa to be a random version each time. Orlando should not be the same Detroit each time.
Output for 7.4.14
Welcome to Atlanta. I want Orlando to be a random version each time. Detroit should not be the same Miami each time.
Output for 7.4.13
Welcome to Atlanta. I want Detroit to be a random version each time. Miami should not be the same Orlando each time.
Output for 7.4.11
Welcome to Detroit. I want Orlando to be a random version each time. Miami should not be the same Dallas each time.
Output for 7.4.10
Welcome to Tampa. I want Dallas to be a random version each time. Atlanta should not be the same Miami each time.
Output for 7.4.9
Welcome to Dallas. I want Atlanta to be a random version each time. Miami should not be the same Tampa each time.
Output for 7.4.8
Welcome to Miami. I want Atlanta to be a random version each time. Dallas should not be the same Tampa each time.
Output for 7.4.7
Welcome to Dallas. I want Tampa to be a random version each time. Orlando should not be the same Atlanta each time.
Output for 7.4.6
Welcome to Orlando. I want Atlanta to be a random version each time. Dallas should not be the same Miami each time.
Output for 7.4.5
Welcome to Miami. I want Dallas to be a random version each time. Detroit should not be the same Tampa each time.
Output for 7.4.4
Welcome to Detroit. I want Orlando to be a random version each time. Atlanta should not be the same Dallas each time.
Output for 7.4.3
Welcome to Dallas. I want Atlanta to be a random version each time. Detroit should not be the same Orlando each time.
Output for 7.4.2
Welcome to Orlando. I want Atlanta to be a random version each time. Miami should not be the same Dallas each time.
Output for 7.4.1
Welcome to Atlanta. I want Detroit to be a random version each time. Miami should not be the same Dallas each time.
Output for 7.4.0
Welcome to Orlando. I want Miami to be a random version each time. Detroit should not be the same Tampa each time.
Output for 7.3.24
Welcome to Orlando. I want Miami to be a random version each time. Dallas should not be the same Detroit each time.

preferences:
58.03 ms | 480 KiB | 5 Q