![]() |
|
|||||||
|
|
Thread Tools | Search this Thread | Rate Thread |
|
#1
|
|||
|
|||
a quick question about using classes, objects and their properties...Ok so here is my problem: I have the following code lines from a tutorial:
PHP Code:
PHP Code:
PHP Code:
thanx in advance, very n00b in this... |
|
#2
|
|||
|
|||
Re: a quick question about using classes, objects and their properties...<?
// our class class math { // our variables var $x=1; var $y=2; // our functions function sum() { // $this refers to our variables in this class return $this->x + $this->y; } } // declare a new class $s = new math; // show the total of x and y added together using the class function echo "before changing x&y's values x+y = " . $s->sum(); // set class variables to new values $s->x = 3; $s->y = 4; // show the total of x and y added together using the class function echo "after changing x&y's values x+y = " . $s->sum(); ?> |
Recent GIDBlog
2nd Week of IA Training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The