- print_r: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$re = '/{youtube}(.*){\/youtube}/mis';
$str = 'Life is good {youtube}NgBZrRCPCH8{/youtube}
Fun is great! {youtube}joRCPCH8{/youtube}
Earth is round and roll\n {youtube}pwnkfH8{/youtube}';
preg_match_all($re, $str, $matches);
print_r($matches);