View Single Post
Old 12-29-2007, 07:25 PM   #15 (permalink)
xenon
The Frequenter
Newcomer 
 
xenon's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
xenon is on a distinguished road
Default

Quote:
Originally Posted by Wildhoney View Post
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.
xenon is offline  
Reply With Quote
The Following User Says Thank You to xenon For This Useful Post:
deflated (12-29-2007)