<?php $array1 = [ 'key1' => [ 'first string' ], 'key2' => [ 'second array' ] ]; $array2 = [ 'key1' => [ 'new string from second array' ], 'key2' => [ 'second key in this other multidimensional array' ] ]; $outer_string = "Hello, this is my first string\nAnd here you can see another string from my second array"; $replacements = array(); foreach ($array1 as $k => $v) { $replacements[$v[0]] = $array2[$k][0]; } echo strtr($outer_string, $replacements);
You have javascript disabled. You will not be able to edit any code.