- print_r: documentation ( source)
- preg_match_all: documentation ( source)
<?php
preg_match_all(
'#\[(link)(.*?)!?\](.*?)\[\/\\1\]#i',
'[link href="http://www.google.com" title="Google" target="_blank"]Google[/link][link href="http://www.facebook.com"]Facebook[/link]
[link href=\'http://www.twitter.com\' rel="nofollow"]Twitter[/link]',
$StrMatches
);
/* $StrMatches[0] = Full tag string
* $StrMatches[1] = Tag name
* $StrMatches[2] = tag params string
* $StrMatches[3] = Tag content
* */
print_r($StrMatches);