Jump to content

How Do You Pass a Variable Value into a Constructor?


webref.eu

Recommended Posts

Hi All

 

How do you pass a variable value into a constructor? 

 

When a class is being included in a page, and that class contains a constructor, I don't get how you can send variable values into that constructor. 

 

I know how to send a variable value into a function of an instantiated object, but this is different ...

 

Thanks  8)

Link to comment
Share on other sites

OK, thanks guys, but how does this work when the class is being called with: 

 

require_once('class.classname.php');

 

How can I send the variable values when require_once is being used? 

 

Thanks  8)

 

You pass the value(s) when you create the object, not when you import the file.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.