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
php object
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: php object
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
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.............
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.............
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: php object
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:tnx ... i run to a (public, var, $this) thing is this any related to the PHP functions ?
Try this: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" ?
File: inc.php
Code: Select all
<?php
echo "The file was included. <br/>";
?>Code: Select all
<?php
include 'inc.php';
include 'inc.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
tnk u for the reply guys........
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: php object
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".