Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,850 members, 7,810,279 topics. Date: Saturday, 27 April 2024 at 04:32 AM

FREE PHP OOP( Object Oriented Programming) Tutorial. - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / FREE PHP OOP( Object Oriented Programming) Tutorial. (737 Views)

What Is The Purpose Of Frameworks And OOP In PHP? / / How To Send Unlimited Emails With Free Php Mailer (2) (3) (4)

(1) (Reply) (Go Down)

FREE PHP OOP( Object Oriented Programming) Tutorial. by dwebdesign(m): 9:14pm On Sep 21, 2015
would you like to know PHP OOP? If you want to learn how to write cleaner code and reusable codes to be used for multiple projects. then OOP is a must learn for you. It simplies the php programming and helps you write reusable codes.

i would like to know those interested so as to know people are interested to learn.

indicate if interested.
Re: FREE PHP OOP( Object Oriented Programming) Tutorial. by chukwuebuka077: 3:56am On Sep 22, 2015
I am interested
Re: FREE PHP OOP( Object Oriented Programming) Tutorial. by webnerd(m): 12:28am On Oct 02, 2015
I'm very interested.
Re: FREE PHP OOP( Object Oriented Programming) Tutorial. by dwebdesign(m): 4:19am On Oct 02, 2015
CLASS 1:

Object Oriented Programming is a programming technique that helps in writing reusable codes and cleaner codes.
What is an object? When a class is instantiated, an object is formed.
Let's relate with our environment to as to drive down the meaning of an object and a class.

Houses:

Before a house is built, there is a blueprint that shows the plan of the house, what it will contain, the rooms, the ways the house will function and the variables used in forming the house like cement and the rest, variables.

Though this is not the house(object) but a blueprint of how the house will look( a class).

From the illustration above, we know understand what it meant when its said that when a class is instantiated, we get the object of the class.

A class is like a blueprint for a house which is not real, the house built as a result of the blueprint (class) is the house (object),

It may be confusing at first, just follow along.

Let's start the coding so we understand more,

To create a class, use the keyword "class",

<?php

Class nairaland {

Function __construct (){

echo "hello, this is my first OOP class";

}

}

Now you have created your first class in PHP OOP.

Now, instantiate the class to get the object, and we do so below using the keyword "new" and the class name, so: we have,

new nairaland;

Let's store it in a variable, so we have

$firstclass= new nairaland;

the call the constructor function that runs always whenever a class is instatiated.

Do it like this:

echo $firstclass;

If done alright and all steps followed, you should have "hello, this is my first OOP class"

echoed out.

To understand that we are truly dealing with an object, do this test,

$var_dump($firstclass);

Or print_r($firstclass);

Okay, that's introduction,

Drop any question.

(1) (Reply)

I Am In Need Of A Website / Working Mp3 Tag Editor For All Host. / Which Software's Do I Use To Edit And Run My Web Script Offline

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 10
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.