Method is actually a function used in the context of a class/object.
When you create a function outside of a class/object, you can call it a function but when you create a function inside a class, you can call it a method.
class foo {
public function bar() { // a method
........
}
}
function bar() { // a function not part of an object
}
So an object can have methods (functions) and properties (variables).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…