Chaitanya Lakshmi
  • About Me
  • Job Duties
  • Knowledge Blog
  • Applications
  • Contact Us
    • Linked In
    • Facebook
  • About Me
  • Job Duties
  • Knowledge Blog
  • Applications
  • Contact Us
    • Linked In
    • Facebook

At the end of the execution of the following script, which values will be stored in the $a->my_value array? (Choose 3)

2/27/2012

0 Comments

 
class my_class
{
var $my_value = array();
function my_class ($value)
{
$this->my_value[] = $value;
}
function set_value ($value)
{
$this->$my_value = $value;
}
}
$a = new my_class ('a');
$a->my_value[] = 'b';
$a->set_value ('c');
$a->my_class('d');

  • c
  • b
  • a
  • d
  • e
Answers:
b,a and d

The set_value method of my_class will not work correctly because it uses the expression $this->$my_value, which is a “variable variable” that, under the circumstances will never correspond to any real property of the class.
0 Comments



Leave a Reply.

    Author

    Write something about yourself. No need to be fancy, just an overview.

    Archives

    February 2012

    Categories

    All
    General
    Krds
    Phponweb

    RSS Feed

Powered by Create your own unique website with customizable templates.