1$repl = str_replace(array('[[', ']]'), '', '[[link_to_page]]');// "link_to_page"1
2preg_match_all('/\[\[([^\]]+)\]\]/', $yourText, $matches);
3foreach($matches as $link) {
4 echo $link[1];
5}
61$repl = preg_replace('/(\[|\]){2}/', '', '[[link_to_page]]');// "link_to_page"