How to select the whole variable name including $ in Visual Studio Code in PHP?

You need to remove the $ symbol from the editor.wordSeparators directive. This is the default value:

// Characters that will be used as word separators when doing word related navigations or operations.
"editor.wordSeparators": "`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?",

You can make this language specific if you want, so it only applies to PHP.

The best way is to edit the VsCode settings.json and specify it for the PHP language. You can open it typing VsCode command:

Preferences: open settings (JSON)

And specify inside the "editor.wordSeparators" setting for your language removing the '$' symbol:

"[php]": {
  "editor.wordSeparators": "`~!@#%^&*()-=+[{]}\\|;:'\",.<>/?"