« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 1 of about 1 for parseTagsRecursive (0.002 sec.)
preg_replace_callback — 正規表現検索を行い、コールバック関数を使用して置換を行... 9414
preg_replace_callback (PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8) preg_replace_callback — 正規表現検索を行い、コールバック関数を使用して置換を行う 説明 function preg_replace_callback ( string | array $pattern , callable $callback , string | array ... 造の使用 <?php $input = "通常の位置 [indent] 字下げ [indent] もっと字下げ [/indent] 字下げ [/indent] 通常の位置" ; 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 ; ?> 参考 PCRE のパターン preg_replace_callback_array ...
https://man.mtool.work/php/8.3/function.preg-replace-callback.html
PREV 1 NEXT