say i have the following script:
<?
$test = "aaaaa";
print '"' . preg_replace('/.*/','x',$test) . '"<br>';
$test = "\n\n\n\n\n ";
print '"' . preg_replace('/.*/','x',$test) . '"';
?>
the output i would expect is as follows:
"x"<br>"x"
the output i actually get follows:
"xx"<br>"x
x
x
x
x
x"
so why the difference? why do i get two x's instead of one x for the
first preg_replace, and why does the preg_replace for the new line
characters not give me the same thing as the first preg_replace?
<?
$test = "aaaaa";
print '"' . preg_replace('/.*/','x',$test) . '"<br>';
$test = "\n\n\n\n\n ";
print '"' . preg_replace('/.*/','x',$test) . '"';
?>
the output i would expect is as follows:
"x"<br>"x"
the output i actually get follows:
"xx"<br>"x
x
x
x
x
x"
so why the difference? why do i get two x's instead of one x for the
first preg_replace, and why does the preg_replace for the new line
characters not give me the same thing as the first preg_replace?
Comment