-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
  • 57,247
  • 24
  • 95
  • 149
VeeZ Phone
  • 347
  • 1
  • 3
  • 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,222
  • 13
  • 24