Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9187455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:46:21+00:00 2026-06-17T19:46:21+00:00

My question is very simple, I saw this code in a class: class controller_activity

  • 0

My question is very simple, I saw this code in a class:

class controller_activity {
    function __construct($args) {
        //the variable template is not defined or what happen??
        $this->template = new Template('activity');     
    }
    .......

Usually I see the declaration of variables in a class like “public $template” or similar, but this case, is the same that if I define those variables as usual?, can I add variables in this way directly?, without defining them before?, is it recomendable?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:46:22+00:00Added an answer on June 17, 2026 at 7:46 pm

    is the same that if I define those variables as usual?,

    No, the definition is missing. get_object_vars will show them, but get_class_vars won’t.

    can I add variables in this way directly?,

    Yes, that is possible. They will be publicly visible.

    without defining them before?,

    Yes, without defining them before. They will be publicly visible.

    is it recomendable?

    That depends. Normally not, but there are exceptions to this rule.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay this question is very simple: I have a facebook page, and a website.
Question very simple - say, i got function, which receives array as its arguments
My question is very simple. Take into consideration the code snippets below: set cvsPath
In this Java code: public class Main { public static void main(String[] args) {
My question is very simple and I know the function can be preformed. I
Question is very simple: I'd like to achieve similar functionality to System.IO.Directory class (especially
My question is very simple: I am working on a old legacy code where
It's not a very concrete question. I created a simple project with a help
I have a very simple question, I am just learning jQuery plugins and saw
My question is very simple, I'm trying to dynamically change the width of this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.