- var_export: documentation ( source)
- preg_split: documentation ( source)
<?php
$text = '[this is block
this is also same "block"
this is same block
another same block]
new block!
another new block!
[this is new block
this is also a new block]';
var_export(preg_split('~\[[^\]]*](*SKIP)(*FAIL)|\R~', $text));