I am starting with the PHP PHP and after reviewing different types of classes that I have downloaded from the Internet , I have seen that some - but not all - these sections have an intransitive function with the same name eg.
class MyClass {function mycolas {// function stuff here} function other functions {// more stuff here}}
what works for this merger is? And how does this help in writing classes?
This is an old style if you are using PHP 5 (you want) Those constructors should avoid and instead:
class MyClass {function __construct ()} {// function content here} function elsefunction () {// more stuff here}}
Constructors, in essence, are used to run the initial code and to apply the inventions of the class.
Comments
Post a Comment