[ create a new paste ] login | about

Link: http://codepad.org/3PoxBeQ5    [ raw code | output | fork ]

PHP, pasted on Oct 3:
1
2
3
4
5
6
7
<?php
$out = '[quote=user1;1] [quote=user0;0]some content here[/quote]this is my reply to user0 post[/quote]';
$cnt = 1;
while($cnt != 0){
    $out = preg_replace('/\[quote\=(.*?);(.*?)\](.*?)\[\/quote\]/ms', '<blockquote>Posted by: \1 at \2.<br/>\3</blockquote>', $out, -1, $cnt);
}
echo $out;


Output:
1
<blockquote>Posted by: user1 at 1.<br/> <blockquote>Posted by: user0 at 0.<br/>some content here</blockquote>this is my reply to user0 post</blockquote>


Create a new paste based on this one


Comments: