Hi Stephen!

This is the expected behaviour. Would you be so kind and file a bug report at bugs.php.net, categorizied as Documentation Problem, so we will not forget about this important request. It can happen that currently noone has time for this, and the bug system also acts as a central memory, so we will not forget about fixing these kind of problems.

Thanks,
Goba

Stephen Fromm wrote:
To whom it may concern:

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 to any computer language.

Sincerely,

Stephen J. Fromm, PhD
Bethesda, MD 20814

Reply via email to