【发布时间】:2016-10-04 22:27:46
【问题描述】:
也许这是个愚蠢的问题,但我不明白变量的长度是怎么回事,每一步发生了什么?
$text = 'John';
$text[10] = 'Doe';
echo strlen($text);
//output will be 11
为什么var_dump($text)会显示string(11) "John D"?为什么不会是全名John Doe?
谁能解释一下这一刻?
【问题讨论】:
标签: php variables string-length