preg-replace-callback problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In url 
http://www.php.net/manual/en/function.preg-replace-callback.php
 
I read this example:
<?php$input = "plain [indent] deep [indent] deeper [/indent] deep [/indent] plain";function parseTagsRecursive($input){    $regex = '#\[indent]((?:[^[]|\[(?!/?indent])|(?R))+)\[/indent]#';    if (is_array($input)) {        $input = '<div style="margin-left: 10px">'.$input[1].'</div>';    }    return preg_replace_callback($regex, 'parseTagsRecursive', $input);}$output = parseTagsRecursive($input);echo $output;?> 
 
 
example does not work if there are more deep statement in var I mean if 
$input = "plain [indent] deep [indent] deeper [/indent] deep [/indent] plain
 
          plain [indent] deep [indent] deeper [/indent] deep [/indent] plain
";
 
it does not work corectly how can I solve this problem
 
 
 
 
 
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux