} public function printName() { echo "name: " . $this->name . PHP_EOL; } public function setGPA($gpa) { $this->gpa = $gpa; } public function printMajor() { echo "Major: " . $this->major . PHP_EOL; } } $myStudent = new Student("Steve"); $myStudent->setGPA(2.3); $myStudent->printName(); $myStudent->major = "Information Tech"; $var = "some value"; $number = 41234213424.0; $realnumber = 12341234.1241241; //this is also a comment, datebayo! $arr = array(); $arr[] = 5; $arr[] = "words"; $arr[] = 5345.5345; $arr[] = array("food", "water", "shelter"); print_r($arr); /* this
} public function PrintStudent() { echo "Student: " . PHP_EOL; echo " name: " . PHP_EOL; echo " address: " . PHP_EOL; echo " gpa: " . PHP_EOL; echo " year: " . PHP_EOL; } public function setGpa($gpa) { $this->gpa = $gpa; } } $myStudent = new Student("Steve"); $myStudent->setGPA("2.3"); $myStudent->major = "Information Technology"; $myStudent->printName(); /* this whale block of comments */ $var = "some value"; $var = $var . " some other value"; $number = 412342134; //thi is is a comment $realNumber = 12341234.1241241; //this is also a comment, datebayo $arr = array();
echo "begin script " . $argv[0] . PHP_EOL; class Student { private $name; private $address; private $gpa; private $year; public function __construct($name) { $this->name = $name; # "this" changes private or public variables with whatever variable you give it } public function printName() { echo "name: " . $this->name . PHP_EOL; } public function setGPA($gpa) { $this->gpa = $gpa; echo "gpa: " . $gpa . PHP_EOL; } } $myStudent = new Student("Steve"); $myStudent->printName(); $myStudent->setGPA(4.0); $var = "some value"; $number = 248573289; $realNumber = 1234.453; $arr = array(); //print_r($arr); echo "end script " . $argv[0] . PHP_EOL;
} public function printName() { echo "name: " . $this->name . PHP_EOL; } public function setGPA($gpa) { $this->gpa = $gpa; } public function printGPA() { echo "GPA: " . $this->gpa . PHP_EOL; } } $myStudent = new Student("Joshua"); $myStudent->setGPA(3.43); $myStudent->printName(); $myStudent->printGPA(); $myStudent->major = "Computing and Business"; $var = "some value"; $number = 2223243; $realNumber = 1233223.233323; $arr = array(); $arr[] = 5; $arr[] = "words"; $arr[] = 3453434.3443; $arr[] = array("food", "water", "shelter", "heart"); //print_r($arr); //gives information about type of variable //var_dump($arr); echo "end script " . $argv[0] . PHP_EOL;