|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-11-25 17:01 UTC] ali@php.net
[2003-11-25 17:46 UTC] goba@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 09:00:01 2025 UTC |
Description: ------------ The PHP documentation nowhere indicates whether it's legal to *modify* a string by accessing an individual character in the string with the index operator (curly braces) and an assignment statement, as in: $str = '0123456789'; $str{4} = 'd'; // Now $str should be '0123d56789' While it does work on my machine, I feel the behavior should be documented, as * for all I know, there may be strange side effects (given php's complex copy semantics); * using undocumented language features can result in code that doesn't age or port well; * this is a fundamental aspect of any computer language.