Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
zues778yI always do
app->getContainer()
Thinking bout
app.getContainer()
Do you do
app . getContainer() ?
I didn't know you could add space around it. Curious about other php devs. Looks weird to me apart tho haha -
AllenII16188yFunny that you guys didn't know it was valid--it's not my first time spacing them. Well if it looks that weird to you all, ill do the sensible thing and stick to convention. Thanks everyone
-
Also, don't do ?> at the end. It prevents you from leaking unintended whitespace in your output.
-
AllenII16188y@hjk101 i do agree; I dont know why, the arrows look weird to me period. I guess I'll get used to it soon enough because im starting up a project using Slim to make the API
-
hjk10156968y@AllenII
You do get used to it but almost every other language uses a dot. As I'm multilingual I sometimes pick the wrong operator.
In Perl the dereferencing is even inconsistent: $hash{key}; vs $hashref->{key};. In php it's just a different operator (a one character to long operator at that). -
I like it better without the spaces. But occasionally I do this:
$app->getContainer()
->getSubject()
->getSystem()
->getPath(); -
matanl26448yIn C, dereferencing + access to method uses the -> operator as well, so I can just imagine everything's a pointer and it makes sense
Related Rants
!rant
PHP guys, your equivalent to the dot operator looks weird to me with no whitespace, anybody else spaces out their arrows like this?
undefined
just curious