brsy
nah mang
- May 12, 2011
- 1,530
- 272
Okay, I am starting OOP, and I am wondering if this would work out.
class_lib.php
index.php
class_lib.php
PHP:
<?php
class person {
var $name;
function set_name($new_name) {
$this->name = $new_name;
}
function get_name() {
return $this->name;
}
}
?>
index.php
PHP:
<?php include("class_lib.php"); ?>
<?php
$ztriick = new person();
$mace = new person();
$kryptos->set_name("Chris Davis");
$mace->set_name("Mace Schram");
echo "Mace's full name: " . $mace->name;
?>