Not really sure how to search this, but is there really a difference between these two?
$t = new Test();
// vs...
$t = new Test;
Not really sure how to search this, but is there really a difference between these two?
$t = new Test();
// vs...
$t = new Test;
There are generally accepted rules and they must adhere to.
$t = new Test();
True choise
There is no difference. The __construct() method is executed with both.
There is no differance
Look here:
<?php
class Test {
function printTest() {
echo "Test";
}
}
$t = new Test();
echo $t->printTest();
// vs...
$t = new Test;
echo $t->printTest();
?>
Output:
Test //from Test()
Test //from Test
If the __construct method needs to take in some parameters then you should use
$t = new Class('Param1','Param2');
If it doesn't need to take any parameters then there is no difference between using
$t = new Class;
OR
$t = new Class();