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

Call Functions

Discussion in 'Development' started by Remarkabless, Dec 24, 2017.

  1. Remarkabless

    Remarkabless Slime

    Messages:
    83
    GitHub:
    Remakem
    How can I call functions from a diffrent class. Lets say I have a

    public function EntityArmorChangeEvent ()

    in the Main.php

    And I want to use that function in my

    Armor.php

    how can I call the function from Main.php and use it to check something in Armor.php?
     
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    assume your armor.php have a class called Armor
    and there's a function called check()
    you would need to get an instance of Armor
    like $armor = new Armor
    $armor->check()
    IF your method is static like `static public function staticCheck()`
    you can do `Armor::staticCheck()`
     
  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.