"$this" what type of object it is?

Answers were Sorted based on User's Feedback



"$this" what type of object it is?..

Answer / venky

$this represents the current working class.
if you are accessing the variable or function with in the
same class then $this represents the current working object.
for ex:

class Test{

function fn_testing($a)
{
$a++;
return $a;

}
$c=$this->fn_tesing(1);
}

Is This Answer Correct ?    6 Yes 1 No

"$this" what type of object it is?..

Answer / kapil dhiman

<?php
class DemoTesting{

public $val="India is great";

public function checkThis()
{
//$this-> object of current class
echo $this->val;

}

}

$obj= new DemoTesting();
$obj->checkThis();
?>

Is This Answer Correct ?    5 Yes 0 No

Post New Answer

More PHP Interview Questions

What can I do by cakePHP?

4 Answers  


Explain the difference between require() and require_once()?

0 Answers  


What does empty mean in php?

0 Answers  


What does $globals mean?

0 Answers  


Explain what does $_server means?

0 Answers  






How many types of arrays are there in php?

0 Answers  


What are php data types?

0 Answers  


What is isset function in php?

0 Answers  


What is the difference between for and foreach?

0 Answers  


How to convert a string to lowercase in php?

0 Answers  


Which array function checks if the particular key exists in the array?

0 Answers  


What is a query in a database?

0 Answers  


Categories