12-29-2007, 07:25 PM
|
#15 (permalink)
|
|
The Frequenter
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
|
Quote:
Originally Posted by Wildhoney
Yeah. I don't, but I am always tempted to because accessing characters in a string as you would items in an array seems absurd to me.
|
But then, if you think about it, it makes perfect sense. Think about it: what is an array: an enumeration of various data types. What is a string: an enumeration of characters. So, since they are both enumerations, it makes sense to be able to access strings as arrays. Also, they are not going to remove the curly brace syntax. If my memory is good, they said using curly braces when accessing string elements instead of square brackets is faster for the simple fact that:
- square brackets are made for array data types, and:
- curly braces were later optimized for string data types (in php 4.x I believe)
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
|
|
|
|