<?php $pattern = '/@if\h*(\(((?:[^()]++|(?1))*)\))\s*(.*?)\s*@endif\b/is'; $s = '@if(!empty($title))test and testing@endif'; $subst = "<?php if($2) { ?>$3<?php } ?>"; $result = preg_replace($pattern, $subst, $s); echo $result;
You have javascript disabled. You will not be able to edit any code.