-1
class Affiliates_Shortcodes {

    private $earnings;


    public static function affiliates_user_tree() {

echo $this->earnings;

        }   
    }

Getting error:

Fatal error: Uncaught Error: Using $this when not in object context

tereško
  • 58,060
  • 25
  • 98
  • 150
VeeZ Phone
  • 397
  • 1
  • 4
  • 17

1 Answers1

2

Your method is declared as static. You can't use object properties within static methods. See http://php.net/manual/en/language.oop5.static.php

t1gor
  • 1,244
  • 12
  • 25