Skip to content

Instantly share code, notes, and snippets.

@jeremyfelt
Created January 10, 2023 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeremyfelt/16d732f642df130c5a674b82e9d6f4c4 to your computer and use it in GitHub Desktop.
Save jeremyfelt/16d732f642df130c5a674b82e9d6f4c4 to your computer and use it in GitHub Desktop.
Global this test
<?php
global $two;
$two = 'three';
class testClass {
public $one = 'two';
public function test() {
global ${$this->one}; // Flagged as 8.1 incompatible in PHPCS, but causes no issue.
echo ${$this->one};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment