19 lines
517 B
PHP
19 lines
517 B
PHP
|
<?php
|
||
|
$string = '<?if($var )?>content<endif> text... text... text... <?if($var )?>content<endif> text... text... text...';
|
||
|
$pattern = 'var';
|
||
|
$replacement = 'VAR';
|
||
|
$pattern = '/<\?if\(\$var \)\?>([^>]*)<endif>/i';
|
||
|
$replacement = '<?php if($var ) { echo \'\1\';?>';
|
||
|
#echo preg_replace($pattern, $replacement, $string);
|
||
|
|
||
|
|
||
|
/*$user = preg_replace("<\?if\(\$(.*?)\)\?>(.*?)<endif>/i","<\?php if\($(.*?)\) { echo \'\2\';?>",$user);
|
||
|
echo $user
|
||
|
*/
|
||
|
|
||
|
$user="User1";
|
||
|
$user = preg_replace("(.*)","{1}aaa",$user);
|
||
|
echo $user;
|
||
|
|
||
|
?>
|