|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-11-05 10:46 UTC] vrana@php.net
[2008-11-05 12:16 UTC] aremo at ngi dot it
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 20 19:00:01 2025 UTC |
Description: ------------ Probably a documentation bug. The manual page for preg_replace (especially in the description of $subject) makes it sound as though the replacements were made directly on $subject, while this is not the case. The replacements are only in the returned string. Reproduce code: --------------- #!/usr/bin/php <?php $subject = "big"; $result = preg_replace('#i#','u',$subject); echo $subject.' '.$result; ?> Expected result: ---------------- If the replacement took place in $subject, the program should output "bug bug". Actual result: -------------- The program outputs "big bug".