With my class set up like this:
I can add properties in my html doc and then print
them out again with this:
I hope thats correct !
My question is - this is adding values to the property
$name. How do I add values to the properties $sp_number
and $height ?
Code:
class_lib.php
<?php
class person {
var $name;
var $sp_number;
public $height;
protected $social_insurance;
function __construct($persons_name) {
$this->name = $persons_name;
}
function get_name() {
return $this->name;
}
} // end class
?>
them out again with this:
Code:
HTML Doc
<?php
$stefan = new person("Stefan Mischook");
echo "Stefan's full name: " . $stefan->get_name()."<br>";
?>
My question is - this is adding values to the property
$name. How do I add values to the properties $sp_number
and $height ?