Skip to content
Advertisement

Replacing text between two limts

I have been trying to get the text between two symbols to be replaced with preg_replace, but alas still not quite getting it right as I get a null output that is empty string, this is what I have so far

JavaScript

So an example output I am looking for would be:

JavaScript

To

JavaScript

Advertisement

Answer

You are defining $start and $end as arrays, but using it as normal variables. Try changing your code to this:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement