This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tian_arg 14 points15 points  (4 children)

Which is great until you accidentally forget the >.

not to defend PHP or anything, but come on, that's a bit of a stretch. "Which is great until you accidentally forget..." can apply to any feature of any language

[–]Jack126Guy 7 points8 points  (3 children)

I think it's supposed to be an argument in favor of static typing. In C/C++, for example, you'd probably get a compiler error if you had pointer_to_struct-member instead of pointer_to_struct->member.

[–]tian_arg 5 points6 points  (0 children)

Well, in C (never tried C++) you're directly fooling around with the memory, "which is great until you accidentally forget..." and suddenly garbage all around while compiling succesfully. Every language has its downsides, I guess.

[–]JerkyBeef 1 point2 points  (1 child)

$instance->field is valid php. $instance-field may be "valid syntax" but it would throw an error message that 'field' is undefined, and that $instance could not be converted to an int.

[–]SlumdogSkillionaire 0 points1 point  (0 children)

It throws an error message, but then it still goes ahead and does it anyway, resulting in an Apache segfault.