3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Store them as key/value pairs with the search and replacement strings $wordsList = [ 'frog' => 'sock', 'Nock' => 'crock', ]; $message = str_replace( array_keys($wordsList), // Get all keys as the search array $wordsList, // The replacements "frog frog Nock Nock" ); echo $message;

preferences:
26.78 ms | 405 KiB | 5 Q