instantiating a class without assigning to a variable
php
Solution
Yes, that's perfectly valid. However, it is arguably bad form, because the golden rule is that:
Constructors should not do actual work.
A constructor should set up an object so that it is valid and in a "ready state". The constructor should not start to perform work on its own. As such, this would be saner:
$monkeys = new Monkeys;
$monkeys->goWild();
Or, if you prefer and are running a sufficiently advanced PHP version:
(new Monkeys)->goWild();
Problem
I have a need to call a class which will perform actions but which I know I will not be calling the methods of. This is a PHP application. Does anyone ever just do the following: ``` require('class.Monkeys.php'); new Monkeys(); //note I didn't assign it to a variable ```