SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Word Press
Unit :1
Topics
By :Rathod Shukar
Points
1 : Class
2 : Property
3 : Visibility
4 : Constructor
5 : Destructor
6 : Inheritance
7 : Scope resolution(::)
8 : Autoloding Classes
9 : Class Constance
10 : Mysql(ins,upd,dlt..)
By :Rathod Shukar
 A class is user defined data type that contains
attributes or data members; and methods which
work on the data members.
 To create a class, you need to use the keyword
class followed by the name of the class. The
name of the class should be meaningful to exist
within the system.
 The body of the class is placed between two curly
brackets within which you declare class data
members/variables and class methods.
Class :
By :Rathod Shukar
class structure
class <class-name>
{
<class body :-
Data Members & Methods>;
}
By :Rathod Shukar
Example
class Customer {
private $first_name, $last_name;
public function getData($first_name, $last_name)
{
$this->first_name = $first_name;
$this->last_name = $last_name;
}
public function printData()
{
echo $this->first_name . " : " . $this->last_name;
}
}
By :Rathod Shukar
Object:-
 An object is a living instance of a class.
This means that an object is created from
the definition of the class and is loaded in
memory.
 Syntax :
 $obj_name = new ClassName();
By :Rathod Shukar
Properties :
 Class member variables are called "properties".
 You may also see them referred to using other
terms such as "attributes" or "fields", but for the
purposes of this reference we will use
"properties".
 They are defined by using one of the
keywords public, protected, or private, followed
by a normal variable declaration.
 This declaration may include an initialization,
but this initialization must be a constant value--
that is, it must be able to be evaluated at
compile time and must not depend on run-time
information in order to be evaluated
By :Rathod Shukar
Visibility :
 Public refers to methods and properties which
can be accessed or called from both within the
object itself and outside of the object (e.g. other
files and objects)
 Private refers to methods and properties which
can only be accessed or called from within the
object itself
 Protected refers to methods and properties
which can be accessed or called from within the
object itself and objects which extend from the
object (child objects) By :Rathod Shukar
Constructor:-
 A constructor is a special function of a class that is
automatically executed whenever an object of a class
gets instantiated.
 It is needed as it provides an opportunity for doing
necessary setup operations like initializing class
variables, opening database connections or socket
connections, etc. In simple terms, it is needed to setup
the object before it can be used.
 In PHP5 a constructor is defined by implementing the
__construct() method. This naming style has been
introduced in PHP5. In PHP4, the name of the
constructor was the same name as that of the class. So,
for example if you had a class Customer, you would
have to implement a function Customer().
By :Rathod Shukar
Syntax
class classname
{
public function __construct()
{
//code
}
}
By :Rathod Shukar
class Customer
{
private $first_name;
public function __construct()
{
$first_name = "";
$last_name = "";
$outstanding_amount = 0;
}
public function setData($first_name)
{
$this->first_name = $first_name;
}
public function printData() {
echo "Name : " . $first_name ;
}
}
$c1 = new Customer(); //object
$c1->setData("Sunil”); //call class method
By :Rathod Shukar
Destructor:-
 PHP 5 introduces a destructor concept
similar to that of other object-oriented
languages, such as C++.
 The destructor method will be called as
soon as there are no other references to a
particular object, or in any order during the
shutdown sequence.
By :Rathod Shukar
Destructor Example
<?php
class MyDestructableClass
{
function __construct()
{
print "In constructorn";
$this->name = "MyDestructableClass";
}
function __destruct()
{
print "Destroying " . $this->name . "n";
}
}
$obj = new MyDestructableClass();
?> By :Rathod Shukar
Inheritance:-
 One of the main feature of Object Oriented
Programing which is called Inheritance. Basically
Inheritance is a mechanism where a new class
is derived from the existing base class.
 The derived class shares/inherit the functionality
of the base class. To extend the class behavior
PHP5 have introduced a new keyword called
“extends“.
 Note : Parent is the Keyword in PHP5, so donot
use in class, variable, object or method name.
By :Rathod Shukar
< ?
class parent1
{
protected $firstname = 11;
protected $lastname = 23;
}
class children extends parent1
{
function __construct()
{
echo $this->firstname;
echo $this->lastname;
}
}
$a = new children();
?>
By :Rathod Shukar
Scope Resolution Operator (::)
 The Scope Resolution Operator (also
called Paamayim Nekudotayim) or in
simpler terms, the double colon, is a token
that allows access to static, constant, and
overridden properties or methods of a
class.
 When referencing these items from
outside the class definition, use the name
of the class.
By :Rathod Shukar
 Paamayim Nekudotayim would, at first,
seem like a strange choice for naming a
double-colon. However, while writing the
Zend Engine 0.5 (which powers PHP 3),
that's what the Zend team decided to call
it. It actually does mean double-colon - in
Hebrew!
By :Rathod Shukar
Example #1 :: from outside the class definition
<?php
class MyClass
{
const CONST_VALUE = 'A constant value';
}
$classname = 'MyClass';
echo $classname::CONST_VALUE;
echo MyClass::CONST_VALUE;
?>
By :Rathod Shukar
Autoloading Classes
 Many developers writing object-oriented
applications create one PHP source file per
class definition.
 One of the biggest annoyances is having to
write a long list of needed includes at the
beginning of each script (one for each class).
 this is no longer necessary.
The spl_autoload_register() function registers any number of
autoloaders, enabling for classes and interfaces to be
automatically loaded if they are currently not defined. By
registering autoloaders, PHP is given a last chance to load the
class or interface before it fails with an error.
By :Rathod Shukar
Example #1 Autoload example
<?php
spl_autoload_register(function ($class_name)
{
include $class_name . '.php';
});
$obj = new MyClass1();
$obj2 = new MyClass2();
?>
By :Rathod Shukar
Class Constants
 It is possible to define constant values on a per-class basis
remaining the same and unchangeable. Constants differ from
normal variables in that you don't use the $ symbol to declare
or use them.
 The default visibility of class constants is public.
 The value must be a constant expression, not (for example) a
variable, a property, or a function call.
 It's also possible for interfaces to have constants. Look at
the interface documentation for examples.
 it's possible to reference the class using a variable. The
variable's value can not be a keyword
(e.g. self, parent and static).
 Note that class constants are allocated once per class, and not
for each class instance.
By :Rathod Shukar
Example #1 Defining and using a constant
<?php
class MyClass
{
const CONSTANT = 'constant value';
function showConstant() {
echo self::CONSTANT . "n";
}
}
echo MyClass::CONSTANT . "n";
$classname = "MyClass";
echo $classname::CONSTANT . "n";
$class = new MyClass();
$class->showConstant();
echo $class::CONSTANT."n";
?>
By :Rathod Shukar
What is MySQL?
MySQL is a database.
The data in MySQL is stored in database objects called tables.
A table is a collection of related data entries and it consists of
columns and rows.
Databases are useful when storing information categorically.
A company may have a database with the following tables:
"Employees", "Products", "Customers" and "Orders".
PHP MySQL Introduction`
MySQL is the most popular open-source database system.
By :Rathod Shukar
LastName FirstName Address City
Hansen Ola Timoteivn 10 Sandnes
Svendson Tove Borgvn 23 Sandnes
Pettersen Kari Storgt 20 Stavanger
Database Tables
A database most often contains one or more tables. Each table is identified
by a name (e.g. "Customers" or "Orders"). Tables contain records (rows)
with data.
Below is an example of a table called "Persons":
The table above contains three records
(one for each person) and four columns (LastName, FirstName,
Address, and City).
By :Rathod Shukar
Queries
A query is a question or a request.
With MySQL, we can query a database for specific information and
have a recordset returned.
SELECT LastName FROM Persons
:
LastName
Hansen
Svendson
Pettersen
The query above selects all the data in the "LastName" column from the "Persons" table
, and will return a recordset like this:
By :Rathod Shukar
PHP MySQL Connect to a Database`
Create a Connection to a MySQL Database
Before you can access data in a database, you must create a
connection to the database.
In PHP, this is done with the mysql_connect() function.
mysql_connect(servername,username,password);
Parameter Description
servername Optional. Specifies the server to connect to. Default value is
"localhost:3306"
username Optional. Specifies the username to log in with. Default value
is the name of the user that owns the server process
password Optional. Specifies the password to log in with. Default is ""
By :Rathod Shukar
Database Connection :
<?php
$con=mysql_connect("localhost","root","");
if($con)
{
echo"data base is conected....!!!!";
}
else
{
echo"data base is Not conected....!!!!";
}
?>
Mysql (insert,Update,Delete)
By :Rathod Shukar
Database Selection :
<?php
$db=mysql_select_db(“DatabaseName",$con);
if($db)
{
echo"data base is selected....!!!!";
}
else
{
echo"data base is Not selected....!!!!";
}
?>
By :Rathod Shukar
Insert :
Syntext :
$var=insert into tableName(field1, field1,…) Values(, , );
Ex :
<?php
$ins="insert into department(DeptNo,Name) values(1,’BCA’)“
?>
By :Rathod Shukar
Update :
Syntext :
$var="update Tab_Name set field=‘value’ where
Condition_Field=‘Value’”;
<php
$upd="update Tab_Name set Name=‘srita’ where DeptNo=‘1’;
?>
By :Rathod Shukar
Delete :
Syntext :
$var="delete from Table_Name where
Condition_Field=‘Value'";
<php
$del="delete from department where DeptNo='$del'";
?>
By :Rathod Shukar

Weitere ähnliche Inhalte

Was ist angesagt?

Classes and objects
Classes and objectsClasses and objects
Classes and objectsrajveer_Pannu
 
XML SAX PARSING
XML SAX PARSING XML SAX PARSING
XML SAX PARSING Eviatar Levy
 
Class and object in c++
Class and object in c++Class and object in c++
Class and object in c++NainaKhan28
 
Introduction to class in java
Introduction to class in javaIntroduction to class in java
Introduction to class in javakamal kotecha
 
09 Object Oriented Programming in PHP #burningkeyboards
09 Object Oriented Programming in PHP #burningkeyboards09 Object Oriented Programming in PHP #burningkeyboards
09 Object Oriented Programming in PHP #burningkeyboardsDenis Ristic
 
Xml query language and navigation
Xml query language and navigationXml query language and navigation
Xml query language and navigationRaghu nath
 
03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slotsmha4
 
Object-Oriented Programming with Perl and Moose
Object-Oriented Programming with Perl and MooseObject-Oriented Programming with Perl and Moose
Object-Oriented Programming with Perl and MooseDave Cross
 
Lect 1-java object-classes
Lect 1-java object-classesLect 1-java object-classes
Lect 1-java object-classesFajar Baskoro
 
Core Java Programming | Data Type | operator | java Control Flow| Class 2
Core Java Programming | Data Type | operator | java Control Flow| Class 2Core Java Programming | Data Type | operator | java Control Flow| Class 2
Core Java Programming | Data Type | operator | java Control Flow| Class 2Sagar Verma
 
Introduction to OO Perl with Moose
Introduction to OO Perl with MooseIntroduction to OO Perl with Moose
Introduction to OO Perl with MooseDave Cross
 
Java cheat sheet
Java cheat sheet Java cheat sheet
Java cheat sheet Saifur Rahman
 
Wed 1630 greene_robert_color
Wed 1630 greene_robert_colorWed 1630 greene_robert_color
Wed 1630 greene_robert_colorDATAVERSITY
 
object oriented programming language by c++
object oriented programming language by c++object oriented programming language by c++
object oriented programming language by c++Mohamad Al_hsan
 
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...GeeksLab Odessa
 
2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++Jeff TUYISHIME
 
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...Sagar Verma
 
Java: Objects and Object References
Java: Objects and Object ReferencesJava: Objects and Object References
Java: Objects and Object ReferencesTareq Hasan
 

Was ist angesagt? (20)

Classes and objects
Classes and objectsClasses and objects
Classes and objects
 
Java XML Parsing
Java XML ParsingJava XML Parsing
Java XML Parsing
 
XML SAX PARSING
XML SAX PARSING XML SAX PARSING
XML SAX PARSING
 
Class and object in c++
Class and object in c++Class and object in c++
Class and object in c++
 
Introduction to class in java
Introduction to class in javaIntroduction to class in java
Introduction to class in java
 
09 Object Oriented Programming in PHP #burningkeyboards
09 Object Oriented Programming in PHP #burningkeyboards09 Object Oriented Programming in PHP #burningkeyboards
09 Object Oriented Programming in PHP #burningkeyboards
 
Xml query language and navigation
Xml query language and navigationXml query language and navigation
Xml query language and navigation
 
03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots03 object-classes-pbl-4-slots
03 object-classes-pbl-4-slots
 
Object-Oriented Programming with Perl and Moose
Object-Oriented Programming with Perl and MooseObject-Oriented Programming with Perl and Moose
Object-Oriented Programming with Perl and Moose
 
Lect 1-java object-classes
Lect 1-java object-classesLect 1-java object-classes
Lect 1-java object-classes
 
Core Java Programming | Data Type | operator | java Control Flow| Class 2
Core Java Programming | Data Type | operator | java Control Flow| Class 2Core Java Programming | Data Type | operator | java Control Flow| Class 2
Core Java Programming | Data Type | operator | java Control Flow| Class 2
 
Introduction to OO Perl with Moose
Introduction to OO Perl with MooseIntroduction to OO Perl with Moose
Introduction to OO Perl with Moose
 
Java cheat sheet
Java cheat sheet Java cheat sheet
Java cheat sheet
 
Wed 1630 greene_robert_color
Wed 1630 greene_robert_colorWed 1630 greene_robert_color
Wed 1630 greene_robert_color
 
object oriented programming language by c++
object oriented programming language by c++object oriented programming language by c++
object oriented programming language by c++
 
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
Java/Scala Lab 2016. Григорий Кравцов: Реализация и тестирование DAO слоя с н...
 
2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++
 
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
 
Java: Objects and Object References
Java: Objects and Object ReferencesJava: Objects and Object References
Java: Objects and Object References
 
Database programming
Database programmingDatabase programming
Database programming
 

Ähnlich wie Wordpress (class,property,visibility,const,destr,inheritence,mysql etc)

Class 7 - PHP Object Oriented Programming
Class 7 - PHP Object Oriented ProgrammingClass 7 - PHP Object Oriented Programming
Class 7 - PHP Object Oriented ProgrammingAhmed Swilam
 
OOPS IN PHP.pptx
OOPS IN PHP.pptxOOPS IN PHP.pptx
OOPS IN PHP.pptxrani marri
 
Oops concepts in php
Oops concepts in phpOops concepts in php
Oops concepts in phpCPD INDIA
 
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering College
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering CollegeObject Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering College
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering CollegeDhivyaa C.R
 
Only oop
Only oopOnly oop
Only oopanitarooge
 
Advanced php
Advanced phpAdvanced php
Advanced phphamfu
 
Synapseindia object oriented programming in php
Synapseindia object oriented programming in phpSynapseindia object oriented programming in php
Synapseindia object oriented programming in phpSynapseindiappsdevelopment
 
Object oriented programming in php
Object oriented programming in phpObject oriented programming in php
Object oriented programming in phpAashiq Kuchey
 
Object_oriented_programming_OOP_with_PHP.pdf
Object_oriented_programming_OOP_with_PHP.pdfObject_oriented_programming_OOP_with_PHP.pdf
Object_oriented_programming_OOP_with_PHP.pdfGammingWorld2
 
Introduction to OOP with PHP
Introduction to OOP with PHPIntroduction to OOP with PHP
Introduction to OOP with PHPMichael Peacock
 
Computer programming(C++): Structures
Computer programming(C++): StructuresComputer programming(C++): Structures
Computer programming(C++): StructuresJishnuNath7
 
psnreddy php-oops
psnreddy  php-oopspsnreddy  php-oops
psnreddy php-oopssatya552
 
Lecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxLecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxShaownRoy1
 

Ähnlich wie Wordpress (class,property,visibility,const,destr,inheritence,mysql etc) (20)

Class 7 - PHP Object Oriented Programming
Class 7 - PHP Object Oriented ProgrammingClass 7 - PHP Object Oriented Programming
Class 7 - PHP Object Oriented Programming
 
OOPS IN PHP.pptx
OOPS IN PHP.pptxOOPS IN PHP.pptx
OOPS IN PHP.pptx
 
Oops concepts in php
Oops concepts in phpOops concepts in php
Oops concepts in php
 
UNIT III (8).pptx
UNIT III (8).pptxUNIT III (8).pptx
UNIT III (8).pptx
 
UNIT III (8).pptx
UNIT III (8).pptxUNIT III (8).pptx
UNIT III (8).pptx
 
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering College
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering CollegeObject Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering College
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering College
 
Only oop
Only oopOnly oop
Only oop
 
Unit3 part1-class
Unit3 part1-classUnit3 part1-class
Unit3 part1-class
 
Jscript part2
Jscript part2Jscript part2
Jscript part2
 
Advanced php
Advanced phpAdvanced php
Advanced php
 
Synapseindia object oriented programming in php
Synapseindia object oriented programming in phpSynapseindia object oriented programming in php
Synapseindia object oriented programming in php
 
Object oriented programming in php
Object oriented programming in phpObject oriented programming in php
Object oriented programming in php
 
Object_oriented_programming_OOP_with_PHP.pdf
Object_oriented_programming_OOP_with_PHP.pdfObject_oriented_programming_OOP_with_PHP.pdf
Object_oriented_programming_OOP_with_PHP.pdf
 
Php oop (1)
Php oop (1)Php oop (1)
Php oop (1)
 
Introduction to OOP with PHP
Introduction to OOP with PHPIntroduction to OOP with PHP
Introduction to OOP with PHP
 
Spsl vi unit final
Spsl vi unit finalSpsl vi unit final
Spsl vi unit final
 
Spsl v unit - final
Spsl v unit - finalSpsl v unit - final
Spsl v unit - final
 
Computer programming(C++): Structures
Computer programming(C++): StructuresComputer programming(C++): Structures
Computer programming(C++): Structures
 
psnreddy php-oops
psnreddy  php-oopspsnreddy  php-oops
psnreddy php-oops
 
Lecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxLecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptx
 

KĂźrzlich hochgeladen

Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...SUHANI PANDEY
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...roncy bisnoi
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Delhi Call girls
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubaikojalkojal131
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...nilamkumrai
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Servicegwenoracqe6
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...SUHANI PANDEY
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445ruhi
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceEscorts Call Girls
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...SUHANI PANDEY
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 

KĂźrzlich hochgeladen (20)

Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
 
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
Hire↠Young Call Girls in Tilak nagar (Delhi) ☎️ 9205541914 ☎️ Independent Esc...
 
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls DubaiDubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
Dubai=Desi Dubai Call Girls O525547819 Outdoor Call Girls Dubai
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts ServiceReal Escorts in Al Nahda +971524965298 Dubai Escorts Service
Real Escorts in Al Nahda +971524965298 Dubai Escorts Service
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 

Wordpress (class,property,visibility,const,destr,inheritence,mysql etc)

  • 2. Points 1 : Class 2 : Property 3 : Visibility 4 : Constructor 5 : Destructor 6 : Inheritance 7 : Scope resolution(::) 8 : Autoloding Classes 9 : Class Constance 10 : Mysql(ins,upd,dlt..) By :Rathod Shukar
  • 3.  A class is user defined data type that contains attributes or data members; and methods which work on the data members.  To create a class, you need to use the keyword class followed by the name of the class. The name of the class should be meaningful to exist within the system.  The body of the class is placed between two curly brackets within which you declare class data members/variables and class methods. Class : By :Rathod Shukar
  • 4. class structure class <class-name> { <class body :- Data Members & Methods>; } By :Rathod Shukar
  • 5. Example class Customer { private $first_name, $last_name; public function getData($first_name, $last_name) { $this->first_name = $first_name; $this->last_name = $last_name; } public function printData() { echo $this->first_name . " : " . $this->last_name; } } By :Rathod Shukar
  • 6. Object:-  An object is a living instance of a class. This means that an object is created from the definition of the class and is loaded in memory.  Syntax :  $obj_name = new ClassName(); By :Rathod Shukar
  • 7. Properties :  Class member variables are called "properties".  You may also see them referred to using other terms such as "attributes" or "fields", but for the purposes of this reference we will use "properties".  They are defined by using one of the keywords public, protected, or private, followed by a normal variable declaration.  This declaration may include an initialization, but this initialization must be a constant value-- that is, it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated By :Rathod Shukar
  • 8. Visibility :  Public refers to methods and properties which can be accessed or called from both within the object itself and outside of the object (e.g. other files and objects)  Private refers to methods and properties which can only be accessed or called from within the object itself  Protected refers to methods and properties which can be accessed or called from within the object itself and objects which extend from the object (child objects) By :Rathod Shukar
  • 9. Constructor:-  A constructor is a special function of a class that is automatically executed whenever an object of a class gets instantiated.  It is needed as it provides an opportunity for doing necessary setup operations like initializing class variables, opening database connections or socket connections, etc. In simple terms, it is needed to setup the object before it can be used.  In PHP5 a constructor is defined by implementing the __construct() method. This naming style has been introduced in PHP5. In PHP4, the name of the constructor was the same name as that of the class. So, for example if you had a class Customer, you would have to implement a function Customer(). By :Rathod Shukar
  • 10. Syntax class classname { public function __construct() { //code } } By :Rathod Shukar
  • 11. class Customer { private $first_name; public function __construct() { $first_name = ""; $last_name = ""; $outstanding_amount = 0; } public function setData($first_name) { $this->first_name = $first_name; } public function printData() { echo "Name : " . $first_name ; } } $c1 = new Customer(); //object $c1->setData("Sunil”); //call class method By :Rathod Shukar
  • 12. Destructor:-  PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such as C++.  The destructor method will be called as soon as there are no other references to a particular object, or in any order during the shutdown sequence. By :Rathod Shukar
  • 13. Destructor Example <?php class MyDestructableClass { function __construct() { print "In constructorn"; $this->name = "MyDestructableClass"; } function __destruct() { print "Destroying " . $this->name . "n"; } } $obj = new MyDestructableClass(); ?> By :Rathod Shukar
  • 14. Inheritance:-  One of the main feature of Object Oriented Programing which is called Inheritance. Basically Inheritance is a mechanism where a new class is derived from the existing base class.  The derived class shares/inherit the functionality of the base class. To extend the class behavior PHP5 have introduced a new keyword called “extends“.  Note : Parent is the Keyword in PHP5, so donot use in class, variable, object or method name. By :Rathod Shukar
  • 15. < ? class parent1 { protected $firstname = 11; protected $lastname = 23; } class children extends parent1 { function __construct() { echo $this->firstname; echo $this->lastname; } } $a = new children(); ?> By :Rathod Shukar
  • 16. Scope Resolution Operator (::)  The Scope Resolution Operator (also called Paamayim Nekudotayim) or in simpler terms, the double colon, is a token that allows access to static, constant, and overridden properties or methods of a class.  When referencing these items from outside the class definition, use the name of the class. By :Rathod Shukar
  • 17.  Paamayim Nekudotayim would, at first, seem like a strange choice for naming a double-colon. However, while writing the Zend Engine 0.5 (which powers PHP 3), that's what the Zend team decided to call it. It actually does mean double-colon - in Hebrew! By :Rathod Shukar
  • 18. Example #1 :: from outside the class definition <?php class MyClass { const CONST_VALUE = 'A constant value'; } $classname = 'MyClass'; echo $classname::CONST_VALUE; echo MyClass::CONST_VALUE; ?> By :Rathod Shukar
  • 19. Autoloading Classes  Many developers writing object-oriented applications create one PHP source file per class definition.  One of the biggest annoyances is having to write a long list of needed includes at the beginning of each script (one for each class).  this is no longer necessary. The spl_autoload_register() function registers any number of autoloaders, enabling for classes and interfaces to be automatically loaded if they are currently not defined. By registering autoloaders, PHP is given a last chance to load the class or interface before it fails with an error. By :Rathod Shukar
  • 20. Example #1 Autoload example <?php spl_autoload_register(function ($class_name) { include $class_name . '.php'; }); $obj = new MyClass1(); $obj2 = new MyClass2(); ?> By :Rathod Shukar
  • 21. Class Constants  It is possible to define constant values on a per-class basis remaining the same and unchangeable. Constants differ from normal variables in that you don't use the $ symbol to declare or use them.  The default visibility of class constants is public.  The value must be a constant expression, not (for example) a variable, a property, or a function call.  It's also possible for interfaces to have constants. Look at the interface documentation for examples.  it's possible to reference the class using a variable. The variable's value can not be a keyword (e.g. self, parent and static).  Note that class constants are allocated once per class, and not for each class instance. By :Rathod Shukar
  • 22. Example #1 Defining and using a constant <?php class MyClass { const CONSTANT = 'constant value'; function showConstant() { echo self::CONSTANT . "n"; } } echo MyClass::CONSTANT . "n"; $classname = "MyClass"; echo $classname::CONSTANT . "n"; $class = new MyClass(); $class->showConstant(); echo $class::CONSTANT."n"; ?> By :Rathod Shukar
  • 23. What is MySQL? MySQL is a database. The data in MySQL is stored in database objects called tables. A table is a collection of related data entries and it consists of columns and rows. Databases are useful when storing information categorically. A company may have a database with the following tables: "Employees", "Products", "Customers" and "Orders". PHP MySQL Introduction` MySQL is the most popular open-source database system. By :Rathod Shukar
  • 24. LastName FirstName Address City Hansen Ola Timoteivn 10 Sandnes Svendson Tove Borgvn 23 Sandnes Pettersen Kari Storgt 20 Stavanger Database Tables A database most often contains one or more tables. Each table is identified by a name (e.g. "Customers" or "Orders"). Tables contain records (rows) with data. Below is an example of a table called "Persons": The table above contains three records (one for each person) and four columns (LastName, FirstName, Address, and City). By :Rathod Shukar
  • 25. Queries A query is a question or a request. With MySQL, we can query a database for specific information and have a recordset returned. SELECT LastName FROM Persons : LastName Hansen Svendson Pettersen The query above selects all the data in the "LastName" column from the "Persons" table , and will return a recordset like this: By :Rathod Shukar
  • 26. PHP MySQL Connect to a Database` Create a Connection to a MySQL Database Before you can access data in a database, you must create a connection to the database. In PHP, this is done with the mysql_connect() function. mysql_connect(servername,username,password); Parameter Description servername Optional. Specifies the server to connect to. Default value is "localhost:3306" username Optional. Specifies the username to log in with. Default value is the name of the user that owns the server process password Optional. Specifies the password to log in with. Default is "" By :Rathod Shukar
  • 27. Database Connection : <?php $con=mysql_connect("localhost","root",""); if($con) { echo"data base is conected....!!!!"; } else { echo"data base is Not conected....!!!!"; } ?> Mysql (insert,Update,Delete) By :Rathod Shukar
  • 28. Database Selection : <?php $db=mysql_select_db(“DatabaseName",$con); if($db) { echo"data base is selected....!!!!"; } else { echo"data base is Not selected....!!!!"; } ?> By :Rathod Shukar
  • 29. Insert : Syntext : $var=insert into tableName(field1, field1,…) Values(, , ); Ex : <?php $ins="insert into department(DeptNo,Name) values(1,’BCA’)“ ?> By :Rathod Shukar
  • 30. Update : Syntext : $var="update Tab_Name set field=‘value’ where Condition_Field=‘Value’”; <php $upd="update Tab_Name set Name=‘srita’ where DeptNo=‘1’; ?> By :Rathod Shukar
  • 31. Delete : Syntext : $var="delete from Table_Name where Condition_Field=‘Value'"; <php $del="delete from department where DeptNo='$del'"; ?> By :Rathod Shukar