let's say i have a string like this:
$string = 'Lorem Ipsum available, <a href="##article-6##">but the majority</a> have suffered alteration in some form, by injected humour.';
Notice the <a href="##article-6##">but the majority</a>
Using this i want to link my articles based on their id's from the database.
Now, how can a perform a preg_replace on that string to see if i have something like ##article-6## and extract only that number?
Is this idea a good one? Can i do it in a better way?
EDIT:
I did it like this:
$post_content = preg_replace_callback('/##article-(\d+)##/', function($matches){$args = explode(',', $matches[1]); // separate the arguments
return call_user_func_array('article_seo_url', $args); /* pass the arguments to article_seo_url function*/ }, $post_content);
Using this code i can also replace multiple url's