Alternative for my preg_replace code
- by Ben Sinclair
Here is my code... basically it finds any page-NUMBER- within a variable and then replaces it with a page url from an array
$content_text = preg_replace("/page-(\d+)-/sie", '$pageurl[$1]', $content_text);
It works a treat until the NUMBER it finds isn't in the array and it returns an error...
Is there another efficient way I could do this instead?
I liked my code above because it was simple but I may have to use more complex code...