douzhong4222 2013-11-12 09:53
浏览 6

字符串变量末尾的[]是什么? [关闭]

I have a piece of PHP that I am currently porting to Objective-C. Although there is one function that I cannot figure out what it does. More specifically the square brackets [ ] on the end of the $hash2 variable. $hash2 is a sha256 variable and $i == 64.

$hash2[$i];

  • 写回答

4条回答 默认 最新

  • dpkt31779 2013-11-12 09:54
    关注

    It means, the variable is considered as an array. The brackets let you define the index values.

    You can learn more about that in the php manual.

    On the other hand, if the variable is indeed a string, then it will access the n-th character of that string.

    评论

报告相同问题?