PHP Interview questions


Total available count: 33
Subject - PHP Frameworks
Subsubject - PHP

What is overriding in PHP?

PHP Overriding is very easy. As we know that overriding is process of modifying the inherited method. In case of inheritance you only need to create method with same name in your child class which you want to override. Below is the example of overriding of method in php. 

class SlightbookA
{
	public function IQ()
	{
		echo Interview questions;
	}
	public function MC()
	{
		echo Multiple choices;
	}
	}
	class SlightbookB
	{
		function MC($val) //overriding function MC
		{
			echo "$val";
		}
        }
}

$val = new SlightbookB();
$val->MC("Interview questions");   //it will print Interview questions

 




Next 5 interview question(s)

1
What is overloading in PHP?
2
Does PHP support multiple inheritance?
3
Explain about various visibility in PHP?
4
What are Autoloading classes?
5
What is the difference between == and === in PHP?