Skip to content

Instantly share code, notes, and snippets.

@vdvm
Last active December 13, 2023 23:29
Show Gist options
  • Save vdvm/4665450 to your computer and use it in GitHub Desktop.
Save vdvm/4665450 to your computer and use it in GitHub Desktop.
Recursive array str_replace
<?php
function recursive_array_replace($find, $replace, $array) {
if (!is_array($array)) {
return str_replace($find, $replace, $array);
}
$newArray = array();
foreach ($array as $key => $value) {
$newArray[$key] = recursive_array_replace($find, $replace, $value);
}
return $newArray;
}
@herahadi
Copy link

thank you it's solved my problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment