PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have a long unanswered question regarding PHP. It's long unanswered because I can easily get around it, but it means writing two lines of code instead of one.
How can I reference a field of a field of an object in one statement? Eg. How can I turn this:
As a Java developer I considered accessing fields directly to be an awful violation of encapsulation. But, if that's how it's done in PHP then that's how it's done! Who am I to argue?
Now I have another question, but I'll put it in a new thread, as per the forum guidelines.
As a Java developer I considered accessing fields directly to be an awful violation of encapsulation.
Jem
Php doesn't stop you doing bad programming - which maybe helps the learning curve - but it also doesn't stop you doing good programming.
I agree it's important to clearly define an object interface but you can still do that with a bunch of getters and setters, comments, naming conventions etc.
Personally I think the freedom we have in php is one of its best features.