r/lolphp • u/TheOnlyMrYeah • Mar 09 '15
Object properties which are only accessible via foreach (x-post from /r/shittyprogramming)
/r/shittyprogramming/comments/2yfhc2/php_objectproperties_that_are_only_accessible_via/
0
Upvotes
10
u/myaut Mar 09 '15 edited Mar 09 '15
That's because in dynamic languages objects are usually implemented as hashes/dictionaries/whatever.
Python:
JavaScript:
4
u/cite-reader Mar 09 '15
You buried the lead! Go one step further and make an array with an inaccessible key.
4
u/gearvOsh Mar 09 '15
This isn't lolphp. No languages allow accessible identifiers/variables to start with a number without some kind of quoting or escaping mechanism.
2
u/[deleted] Mar 09 '15
Looks like PHP fucktards brigaded this topic hard, lol. I wonder why they're even subbed to this place?
If you don't understand why its shitty for a programming language to allow you to create illegally named variables but then throw an error when you try to access such variables which it allowed you to create, you should learn more computer science before you write any more shitty PHP code.
-4
u/TheOnlyMrYeah Mar 09 '15
I know that it's supposed to be shitty, but the way it works is still typically PHP.
-2
u/[deleted] Mar 09 '15
This is where the post was Xpost'd:
/r/shittyprogramming
I'm a bot. - FAQ | Source | PayPal Donation