Web Hosting Talk







View Full Version : why do PHP uses -> instead of . for objects?


grabmail
02-18-2006, 06:18 AM
Just wondering. '.' just seems more intuitive.

hiryuu
02-18-2006, 06:46 AM
I don't think 'intuitive' is quite the right word, although more familiar perhaps. The basic answer is PHP uses -> because both the -> and . operators are from Perl. I'm not sure why Perl chose those symbols for those operations.

deuce868
02-18-2006, 10:27 AM
. = concatenation. It's been that way and I think it would break backward compatibility to use it for OOP.

grabmail
02-18-2006, 10:31 AM
oh yeah! i totally forgot about that. Those languages that uses . for objects: what do they usually use to concatenate? +?

Real-Hosts
02-18-2006, 10:39 AM
I use ->
Don't know why.. Probably the tutorials I read when learning PHP, or the fact I think its easier to read.