0

Why does this give me an error?

$this->_page->page_text = Messages::msg[$explode[1]];

The structure of Messages is

class Messages
{
    public static $msg = array(...);
    public static $ns = array(...);
}
1
  • Please share more details, like the full and exact error message Commented Dec 13, 2021 at 14:07

1 Answer 1

1

Assuming that $explode is a variable containing some exploded data and you are using the 2nd item in that array as an index for your messsage, you need to use Messages::$msg[$explode[1]];

Variables always start with $

Sign up to request clarification or add additional context in comments.

2 Comments

but the structure of $this->_page is a bunch of variables and I don't need to use $ on those
That's because $this is the variable. Message isn't a variable (its a class), so $msg has to be referenced as the variable since that is what it is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.