note 72076 deleted from language.oop5.basic by nlopess
| From: | nlopess@php.net | Date: | Mon, 01 Jan 2007 10:37:38 +0000 |
| Subject: | note 72076 deleted from language.oop5.basic by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121169@lists.php.net to get a copy of this message | ||
Note Submitter: aeternuslibertas at gmail dot com
----
in php 5 when defining a variable withing a class the $var statement is outdated and instead one
should use, public, private or protected...
like this ......
<?php
//php5
//class definition- object oriented programming
class oop_example{
public $my_variable;
public function my_function(){
echo $this->my_variable;
}
}
$my_object= new oop_example;
$my_object->my_variable="Hello World";
$my_object->my_function();
//the above code results in...
//hello world
?>