php object

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
jamesalexander
Forum Newbie
Posts: 5
Joined: Wed Mar 26, 2008 10:35 pm

php object

Post by jamesalexander »

good day,


i am new to php about a month old programming this kind of language and i still unable to grasp the object programming style that i used to see on tutorials and books

can anybody shed a light on this one

thank u
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: php object

Post by Christopher »

The simplest way to think about an object is as data structure with its own set of local functions that can operate on that data. The 'class' construct creates a namespace for the variables and functions in it. There are obviously many more interesting things you can do once you start coding classes and creating objects from them, but that modularity is the basic benefit.
(#10850)
jamesalexander
Forum Newbie
Posts: 5
Joined: Wed Mar 26, 2008 10:35 pm

Re: php object

Post by jamesalexander »

gud day again...

tnx ... i run to a (public, var, $this) thing is this any related to the PHP functions ?
what is the difference if i type include and the include once does it mean that i can only use the
"whatever inside that function once" ?

thanks for bearing with me.............
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: php object

Post by Christopher »

jamesalexander wrote:tnx ... i run to a (public, var, $this) thing is this any related to the PHP functions ?
If you have PHP4 use var $foo;. If you have PHP then private, protected, public control the what can access the property. There is an example in the manual.
jamesalexander wrote:what is the difference if i type include and the include once does it mean that i can only use the
"whatever inside that function once" ?
Try this:

File: inc.php

Code: Select all

<?php
echo "The file was included. <br/>";
?>
File: test1.php

Code: Select all

<?php
include 'inc.php';
include 'inc.php';
?>
File: test2.php

Code: Select all

<?php
include_once 'inc.php';
include_once 'inc.php';
?>
(#10850)
jamesalexander
Forum Newbie
Posts: 5
Joined: Wed Mar 26, 2008 10:35 pm

Re: php object

Post by jamesalexander »

tnk u for the reply guys........
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: php object

Post by Chris Corbyn »

Please stop using AOL speak in our forums. People who are not primarily English speaking really struggle with it. Words like "u", "r", "4", "2" etc should be replaced their proper words "you", "are", "for", "two".
Post Reply