Quicker String Verification
View Single Post
12-29-2007, 07:25 PM
Join Date: Dec 2007
Location: Bucharest, Romania
Originally Posted by
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.
The Following User Says Thank You to xenon For This Useful Post:
View Public Profile
Send a private message to xenon
Visit xenon's homepage!
Find More Posts by xenon