Link to home
Start Free TrialLog in
Avatar of Zoe Zoe
Zoe Zoe

asked on

Use inside class versus outside class

Recently, I've had to put Use inside a class but I've always seen it put outside the class. What's the difference? When do I need to put it inside and when do I need to put it outside? If I put it outside, I get an error saying that I have an undefined method.

class MY_Controller extends CI_Controller
{
	use Auth;
}

Open in new window


use Auth;
class MY_Controller extends CI_Controller
{
}

Open in new window

SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial