"$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

How do you end a function in python?

0 Answers  


What is php7?

0 Answers  


Explain about image types in detail?

1 Answers   Aplora,


Which framework is best for php?

0 Answers  


What is "echo" in php?

0 Answers  






What is a lambda function in php?

0 Answers  


How to send email using php script?

0 Answers  


What is mod_php?

0 Answers  


What is the purpose of the '.frm' file extension? What do thes file contain?

0 Answers  


Explain about the $_GET variable of PHP?

0 Answers  


Is it worth learning php in 2019?

0 Answers  


What is .htaccessfile and use of this file

5 Answers  


Categories