L
L
leha782015-11-10 17:40:33
PHP
leha78, 2015-11-10 17:40:33

How to use namespace inside a method?

There is a class

class className extends abstractClass
{
 protected function _methodName()
{
include_once (IA_INCLUDES . 'utils' . IA_DS . 'twitteroauth-master/autoload.php');
use Abraham\TwitterOAuth\TwitterOAuth;
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_SECRET);
}
}

But here it gives an error // Parse error: syntax error, unexpected T_USE

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2015-11-10
@leha78

Do not use at all, move use outside the class, where it should be .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question