Alex Bowers wrote on 20/03/2015 13:09:
On 20 March 2015 at 13:04, Rowan Collins <rowan.coll...@gmail.com
<mailto:rowan.coll...@gmail.com>> wrote:
$version{4:} = '7!';
I'm sure this is a slight oversight on your end, but just to check.
The change of using {} instead of [] is not because its a string, and
is just a typo / example correct?
It's an alternative syntax, which I thought was only usable for string
indexing [1] but is apparently legal on arrays as well [2].
I personally like the idea of string offsets having similar but slightly
different syntax from array offsets, to make clear which you're using. I
use {} instead of [] for that reason, but at the moment the syntaxes are
completely interchangeable as far as I can tell.
[1]
http://php.net/manual/en/language.types.string.php#language.types.string.substr
[2]
http://php.net/manual/en/language.types.array.php#language.types.array.syntax.accessing
Regards,
--
Rowan Collins
[IMSoP]