1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

how to Pass Variable

Discussion in 'Development' started by NinjazZtine, Aug 13, 2021.

  1. NinjazZtine

    NinjazZtine Creeper

    Messages:
    2
    GitHub:
    ninjazztine
    hey guys, im new to plugins.

    just wanna know how to use variables from other php files

    ex: i have variable $example on test1.php
    and i want to use the same variable on test2.php
     
  2. KygekDev

    KygekDev Witch

    Messages:
    72
    GitHub:
    KygekDev
    Use public properties.

    Example:
    PHP:
    class One {
        public static 
    $variable "Hello, world!";
    }

    class 
    Two {
        public function 
    printHelloWorld() {
            echo 
    One::$variable;
        }
    }
     
    Reyyan Yaqub and NinjazZtine like this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.