Using one method as Getter and Setter

Instead of writing two methods  in your class with the single purpose of getting or setting a value to a class member, you can simply create one method to do both.

<?php
class foo()
{
    protected
        $var;
    public function bar($string = null)
    {
        if($string === null) {
            return $this->var = $string;
        }
        $this->var = $string;
        return true;
    }
}

$example = new foo();
$example->bar(); // Returns null, no value assigned
$example->bar('Q`pla'); // Returns true, assigns value
$example->bar(); // Returns Q`pla

If no argument is passed to the method, you simply return the assigned value.  If an argument is passed, then you assign the passed value to the class member.

This way your class can remain small(er) and easier to maintain.

[Solved] How To Resolve JQuery Conflicts

Make it a practice to always call jQuery by it’s name, and pass the $ (dollar sign) as the argument and you can use it with out fail after that.

<script>
jQuery(function($) {
    // use the $ alias as much as you want
});
</sciript>

If you follow this simple technique, you don’t need to worry about when you load jQuery along with other JavaScript libraries or making sure to call $.noConflict(); to make the other JavaScript libraries happy.

Question Everything

Whether your a seasoned professional, or if you’re just getting started with web development, the one piece of advise I can give you is…

“Question everything!“

The only thing that’s constant about the Internet, is that it’s constantly changing.  What you do today, will most likely change tomorrow.

You’ll find plenty of tutorials all over the Internet to help you on your way, but to be truly exceptional, you really need to understand what you’re doing, and not just blindly following someones limited instructions.