php include() question, variable & function autocompletion

I am the beginner of PHP, while i am using INCLUDE() in  PHPSTOREM, i found a question,

for example,
I create a file   "abc.php",  and inside it , there is    "  $abc = 10;    function abcFunction(){};"

and in the "123.php", i include  "abc.php" into it ,

i can get the abcFunction() from the auto completion, but $abc does not,

does there is anyone can tell me  which part i have made a mistake

thanks :)

Comment actions Permalink

That is common in IDE's.

If varibles were included in the code completion it would be an awful big mess of options to choose.

Consider working on a big application like WordPress or a framework like CodeIgniter where there are a huge amount of varibles.

But now if it is something that is important that will be re-used throughout the app, then it should be a property or object.
Then it will show under the code completion.

icnlude file

class a
      * @var int
     public $abc = 10;

     public function foo()
          echo 'Bar';

test file

include 'include_test.php';

$test = new a;
echo $test->abc;
echo '<br />';


Should out put

Comment actions Permalink

Hello jacky,

It is possible to obtain 'global variants' in completion also:


At this point invoke completion manually('ctrl'+'space' is default shortcut for Windows\Linux):


Thank you for feedback!

Comment actions Permalink


Thanks for the help!


Please sign in to leave a comment.