Jump to content

Archived

This topic is now archived and is closed to further replies.

emehrkay

how do you say "->" ?

Recommended Posts

I guess that COULD be implemented. It would bring a lot of complex changes to the php core me thinks though..

Not to mention it wouldn't exactly improve readabilty of code...  ;)

Share this post


Link to post
Share on other sites
"->"  is used in c when you have a pointer to a structure and as we all know php is made in c. In c "->" means "points at"

Share this post


Link to post
Share on other sites
Yes, that's what it means and does in C, but it doesn't do the same thing in PHP.

Share this post


Link to post
Share on other sites
You are right it does not do the same thing because php is not c. But pointers to structures and instances are so alike that this is the reason cpp and php and perl and a few others chose to use the points at symbol and that is why i said what I did but after saying this i wonder if php copied perl, c or cpp most probably all 3. I am not quite sure, It might be time for me to learn more of the php internals I have put it off for so long.


Share this post


Link to post
Share on other sites
Maybe the original person(s) that implemented objects in PHP didn't want to deal with the added complexity of dealing with the problems myself and 448191 discussed above; or they didn't [i]know[/i] how to deal with them.

Either way, they chose -> and the bottom line is no one has bothered to go back and implement a dot operator that does the same thing.  And why would anyone want to?  There's no [i]practical[/i] reason in this case to go back and implement a second operator that does the exact same thing as one that already exists.

Share this post


Link to post
Share on other sites
I'm guessing they used -> instead of . because they implemented . as concatenator [i]before[/i] oop was implemented, simple as that. 

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.