What is "_:" ?



I am relatively new PHPStorm user and once in a while I see in my code an icon added by the IDE, which is an underscore followed by a colon. Below I`m attaching a screenshot of what I mean. Can anyone please explain to me what it means.


Hi there,

So far that looks like Parameter Name Hints: https://www.jetbrains.com/help/phpstorm/viewing-reference-information.html#parameter-hints

That particular one must be representing an optional "unlimited" parameter (variadic parameter) -- e.g. var_dump() or sprintf() etc -- they have no fixed number of parameters and can accept 1, 2, 3, 4, 5... 10 of them.


... or perhaps it's just the param name :-?


>... or perhaps it's just the param name :-?

Correct -- if you look at those function declarations (how those params are declared in PhpStorm stubs -- Ctrl+Click to get there) that $_ is used as a parameter name for such variadic parameter.


Please sign in to leave a comment.