How to replace a content that contains backslash and fowardslashes in php
6th Jun, 2023
Click here to share
The code below replaces part of the content that contains multiple forward and backslashes in php
function dazito_filter_content($content)
{
$content = "\/en\/wp-json\/geodir\/v2\/";
$rep = "dzbsh";
$content = str_replace('\\', $rep, $content);
$content = preg_replace("/(en$rep|es$rep|de$rep)\/wp-json$rep\/geodir$rep/", 'wp-json\/geodir', $content);
$content = str_replace($rep, '\\', $content);
return $content;
}
SUBSCRIBE BELOW
To receive weekly newsletter from us signup below, we dont spam, and your information is secure with us
Leave a Reply
RELATED POSTS
Total of
0
Comment