is it possible for a class to accept a dynamic value and make it its private variable?
example:
class test{
private $var = $x;
private function fromUser($var){
//code here
}
}
i want $x to be dynamic like coming from a user input.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
sure you can. You can pass the value dynamically in a constructor or through a method? Would something like work:
you could also define a
settermethod?