Sunday 23 October 2016

Class in PHP | How create classes in PHP

Classes in PHP

Php Classes.Classes in Php is a new concept like C++.It covers the OOPs concept in PHP.OOPs stands for Object Oriented Programming.you can create classes in PHP like c++ with functions.

To do this:

<?php
class abc
{
function add1()
{
$a=10;
$b=20;
$c=$a+$b;
echo $c;
}
}
$obj=new abc;
$obj->add1();
?>

In the above PHP class example, we create a class with name "abc" also create function name "add1"
we declare two variable a and b and assign them value.Add them and assign the result to another variable c and show the result with echo command.

After this, we create an object of the class and call the function using that object. 

We can add multiple classes and functions in PHP.

<?php
class abc
{
function add1()
{
$a=10;
$b=20;
$c=$a+$b;
echo $c;
}
function mul()
{
$a=10;
$b=20;
$c=$a*$b;
echo $c;
}
}
$obj=new abc;
$obj->add1();
echo "</br>";
$obj->mul();

?>

PHP Class



Php Class
Php Class



Wednesday 5 October 2016

What is PHP ? Full form of PHP

PHP

What is PHP?

1.PHP stands for Hypertext Preprocessor.
2.PHP is a server-side script.
3.PHP is executed by the browsers.
4.PHP is free service.

PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages and websites.


PHP is a widely-used, free, and efficient language for website creation.


PHP file using .php extension for saving php files.

PHP Syntax: