本文整理汇总了PHP中Student::add_grade方法的典型用法代码示例。如果您正苦于以下问题:PHP Student::add_grade方法的具体用法?PHP Student::add_grade怎么用?PHP Student::add_grade使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Student
的用法示例。
在下文中一共展示了Student::add_grade方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Student
$first->add_grade(55);
$students['j123'] = $first;
//initialize and add second student to array
$second = new Student();
$second->surname = "Einstein";
$second->first_name = "Albert";
$second->add_email('home', 'albert@braniacs.com');
$second->add_email('work1', 'a_einstein@bcit.ca');
$second->add_email('work2', 'albert@physics.mit.edu');
$second->add_grade(95);
$second->add_grade(80);
$second->add_grade(50);
$students['a456'] = $second;
//initialize and add third student to array
$third = new Student();
$third->surname = "Goncharov";
$third->first_name = "Dima";
$third->add_email('work', 'suicide_party@bcit.com');
$third->add_grade(100);
$third->add_grade(100);
$students['d008'] = $third;
//sort student array by key
ksort($students);
//prints each student out using toString() method
foreach ($students as $student) {
echo $student->toString();
}
?>
</body>
</html>
示例2: Student
$first->add_grade(55);
$students['j123'] = $first;
/*adding a second student*/
$second = new Student();
$second->surname = "Einstein";
$second->first_name = "Albert";
$second->add_email('home', 'albert@braniacs.com');
$second->add_email('work1', 'a_einstein@bcit.ca');
$second->add_email('work2', 'albert@physics.mit.edu');
$second->add_grade(95);
$second->add_grade(80);
$second->add_grade(50);
$students['a456'] = $second;
/*adding a myself*/
$third = new Student();
$third->surname = "Dobrianskaia";
$third->first_name = "Nadia";
$third->add_email('work', 'nadezhdadobrianskaia@gmail.com');
$third->add_grade(95);
$third->add_grade(80);
$students['n789'] = $third;
/*sort the student order*/
ksort($students);
/*displaying the students*/
foreach ($students as $student) {
echo $student->toString();
}
?>
</body>
</html>
示例3: Student
$first->add_grade(75);
$first->add_grade(55);
$students['j123'] = $first;
//Student two
$second = new Student();
$second->surname = "Einstein";
$second->first_name = "Albert";
$second->add_email('home', 'albert@braniacs.com');
$second->add_email('work1', 'a_einstein@bcit.ca');
$second->add_email('work2', 'albert@physics.mit.edu');
$second->add_grade(95);
$second->add_grade(80);
$second->add_grade(50);
$students['a456'] = $second;
//Student three
$third = new Student();
$third->surname = "Arumugam";
$third->first_name = "Jathavan";
$third->add_email('home', 'jathavan.a@gmail.com');
$third->add_grade(95);
$students['A444'] = $third;
ksort($students);
// one of the many sort functions
//Print all the available students
foreach ($students as $student) {
echo $student->toString();
}
?>
</body>
</html>
示例4: Student
$student2 = new Student();
$student2->surname = "Le";
$student2->first_name = "Duy";
$student2->add_email('home', 'duy@hotmail.com');
$student2->add_email('work', 'duy@rcmp.com');
$student2->add_grade(10);
$student2->add_grade(8);
$student2->add_grade(9);
// Add Duy to array of students
$students['duy'] = $student2;
// Create Jens
$student3 = new Student();
$student3->surname = "Christiansen";
$student3->first_name = "Jens";
$student3->add_email('home', 'jens@hotmail.com');
$student3->add_email('work', 'jens@work.com');
$student3->add_grade(100);
$student3->add_grade(89);
$student3->add_grade(99);
// Add Jens to array of students
$students['jens'] = $student3;
// sort by key
ksort($students);
// Print each student
foreach ($students as $student) {
echo $student->toString();
}
?>
</body>
</html>
示例5: Student
$second->surname = "Einstein";
$second->first_name = "Albert";
$second->add_email('home', 'albert@braniacs.com');
$second->add_email('work1', 'a_einstein@bcit.ca');
$second->add_email('work2', 'albert@physics.mit.edu');
$second->add_grade(95);
$second->add_grade(80);
$second->add_grade(50);
$students['a456'] = $second;
$myself = new Student();
$myself->surname = "Becker";
$myself->first_name = "Gerald";
$myself->add_email('home', 'ger_0_1@hotmail.com');
$myself->add_email('work1', 'gerald@workemail.ca');
$myself->add_email('work2', 'gerald@f15eagleger.com');
$myself->add_grade(77);
$myself->add_grade(99);
$myself->add_grade(85);
$students['g00900309'] = $myself;
ksort($students);
?>
<h1>List of Students</h1>
<hr>
<?php
//print all the students
foreach ($students as $student) {
echo $student->toString();
?>
<hr>
<?php
示例6: Student
$second->surname = "Einstein";
$second->first_name = "Albert";
$second->add_email('home', 'albert@braniacs.com');
$second->add_email('work1', 'a_einstein@bcit.ca');
$second->add_email('work2', 'albert@physics.mit.edu');
$second->add_grade(95);
$second->add_grade(80);
$second->add_grade(50);
$students['a456'] = $second;
// Adding a third Student, myself!
$third = new Student();
$third->surname = "Yiu";
$third->first_name = "Julia";
$third->add_email('home', 'jyiu93@gmail.com');
$third->add_email('work', 'jyiu8@my.bcit.ca');
$third->add_grade(90);
$third->add_grade(75);
$third->add_grade(90);
$students['a009'] = $third;
// A sort function that sorts an array by key. In this case, it is
// sorting the Students array.
ksort($students);
// A for-each loop that prints out each student entered
// in the array of students
foreach ($students as $student) {
echo $student->toString();
}
?>
</body>
</html>
示例7: Student
//initialize the second Student
$second = new Student();
$second->surname = "Einstein";
$second->first_name = "Albert";
$second->add_email('home', 'albert@braniacs.com');
$second->add_email('work1', 'a_einstein@bcit.ca');
$second->add_email('work2', 'albert@physics.mit.edu');
$second->add_grade(95);
$second->add_grade(80);
$second->add_grade(50);
$students['a456'] = $second;
//initialize the third Student
$third = new Student();
$third->surname = "Ensom";
$third->first_name = "James";
$third->add_email('home', 'james.ensom@gmail.com');
$third->add_email('work1', 'jensom@bcit.ca');
$third->add_grade(92);
$third->add_grade(88);
$third->add_grade(54);
$students['t789'] = $third;
//sort the Students
ksort($students);
//print out the Students using the toString method
foreach ($students as $student) {
echo $student->toString();
}
?>
</body>
</html>
示例8: Student
$first->add_grade(55);
$students['j123'] = $first;
$second = new Student();
$second->surname = "Einstein";
$second->first_name = "Albert";
$second->add_email('home', 'albert@braniacs.com');
$second->add_email('work1', 'a_einstein@bcit.ca');
$second->add_email('work2', 'albert@physics.mit.edu');
$second->add_grade(95);
$second->add_grade(80);
$second->add_grade(50);
$students['a456'] = $second;
$third = new Student();
$third->surname = "Carpenter";
$third->first_name = "Wilson";
$third->add_email("work", "wcarpenter7@my.bcit.ca");
$third->add_grade(90);
$third->add_grade(97);
$third->add_grade(85);
$third->add_grade(77.5);
$students['w987'] = $third;
//Sort the students by key
ksort($students);
//Display the students and their information
foreach ($students as $s) {
echo $s->toString();
}
?>
</body>
</html>
示例9: Student
//call Student add_grade function
$second->add_grade(95);
$second->add_grade(80);
$second->add_grade(50);
//Adding $first to array with key 'a456'
$students['a456'] = $second;
//Instantiating a Student
$second = new Student();
//Set student surname to 'Chau'
$second->surname = "Chau";
//Set student first name to 'Bryan'
$second->first_name = "Bryan";
//email with key as Home
$second->add_email('home', 'bchau@bchau.com');
//call Student add_grade function
$second->add_grade(95);
$second->add_grade(100);
$second->add_grade(98);
//Adding $first to array with key 'b123'
$students['b123'] = $second;
//Function to sort student array alphabetically via first name
ksort($students);
/*
* A foreach loop that calls the toString method of the
* student class for each student in the students array.
*/
foreach ($students as $student) {
echo $student->toString();
}
//echo "Hello...is anyone out there...";
?>
示例10: Student
//Student 2
$second = new Student();
$second->surname = "Einstein";
$second->first_name = "Albert";
$second->add_email('home', 'albert@braniacs.com');
$second->add_email('work1', 'a_einstein@bcit.ca');
$second->add_email('work2', 'albert@physics.mit.edu');
$second->add_grade(95);
$second->add_grade(80);
$second->add_grade(50);
$students['a456'] = $second;
//Student 3
$third = new Student();
$third->surname = "Wong";
$third->first_name = "Evanna";
$third->add_email('home', 'evannawong92@gmail.com');
$third->add_grade(80);
$third->add_grade(84);
$third->add_grade(70);
$students['e789'] = $third;
//sort student array
ksort($students);
// one of the many sort functions
//print array
foreach ($students as $student) {
echo $student->toString();
}
?>
</body>
</html>
示例11: Student
$second->add_email('work1', 'a_einstein@bcit.ca');
$second->add_email('work2', 'albert@physics.mit.edu');
$second->add_grade(95);
$second->add_grade(80);
$second->add_grade(50);
$students['a456'] = $second;
/**
* Adds the third student (Myself) and defines it's properties
*/
$third = new Student();
$third->surname = "Zhou";
$third->first_name = "Becky";
$third->add_email('home', 'becky@home.com');
$third->add_email('work', 'bzhou@work.ca');
$third->add_email('school', 'bzhou_13@bcit.ca');
$third->add_grade(100);
$third->add_grade(50);
$third->add_grade(60);
$students['b789'] = $third;
/**
* Sorts students in alphabetical order
*/
ksort($students);
/**
* Displays all students
*/
foreach ($students as $student) {
echo $student->toString();
}
?>
示例12: Student
$first->add_email('home', 'john@doe.com');
$first->add_email('work', 'jdoe@mcdonals.com');
$first->add_grade(65);
$first->add_grade(75);
$first->add_grade(55);
$students['j123'] = $first;
$second = new Student();
$second->surname = "Einstein";
$second->first_name = "Albert";
$second->add_email('home', 'albert@brainiacs.com');
$second->add_email('work1', 'a_einstein@bcit.ca');
$second->add_email('work2', 'albert@physics.mit.edu');
$second->add_grade(85);
$second->add_grade(90);
$second->add_grade(50);
$students['a456'] = $second;
$third = new Student();
$third->surname = "Tekenos";
$third->first_name = "Jessica";
$third->add_email('home', 'jessicatekenos@gmail.com');
$third->add_email('school', 'jtekenos@my.bcit.ca');
$third->add_grade(97);
$third->add_grade(88);
$third->add_grade(67);
$students['j514'] = $third;
//sorts students
ksort($students);
//displays each student object in the array
foreach ($students as $student) {
echo $student->toString();
}
示例13: Student
//Add second student
$second = new Student();
$second->surname = "Einstein";
$second->first_name = "Albert";
$second->add_email('home', 'albert@braniacs.com');
$second->add_email('work1', 'a_einstein@bcit.ca');
$second->add_email('work2', 'albert@physics.mit.edu');
$second->add_grade(95);
$second->add_grade(80);
$second->add_grade(50);
$students['a456'] = $second;
//Add third student
$third = new Student();
$third->surname = "Huang";
$third->first_name = "Vincent";
$third->add_email('home', 'poshenhuang123@hotmail.com');
$third->add_email('work', 'vhuang@bcit.ca');
$third->add_grade(99);
$third->add_grade(99);
$third->add_grade(99);
$students['v123'] = $third;
//Sort the student list
ksort($students);
//Print students
foreach ($students as $student) {
echo $student->toString();
}
?>
</body>
</html>
示例14: array
<body>
<?php
include 'student.php';
$students = array();
foreach ($students as $student) {
echo $student->toString();
}
$first = new Student();
$first->surname = "Doe";
$first->first_name = "John";
$first->add_email('home', 'john@doe.com');
$first->add_email('work', 'jdoe@mcdonalds.com');
$first->add_grade(65);
$first->add_grade(75);
$first->add_grade(55);
$students['j123'] = $first;
$second = new Student();
$second->surname = "Einstein";
$second->first_name = "Albert";
$second->add_email('home', 'albert@braniacs.com');
$second->add_email('work1', 'a_einstein@bcit.ca');
$second->add_email('work2', 'albert@physics.mit.edu');
$second->add_grade(95);
$second->add_grade(80);
$second->add_grade(50);
$students['a456'] = $second;
ksort($students);
?>
</body>
</html>
示例15: Student
$first->add_grade(55);
//Creating the second student
$second = new Student();
$second->surname = "Einstein";
$second->first_name = "Albert";
$second->add_email('home', 'albert@braniacs.com');
$second->add_email('work1', 'a_einstein@bcit.ca');
$second->add_email('work2', 'albert@physics.mit.edu');
$second->add_grade(95);
$second->add_grade(80);
$second->add_grade(50);
//Creating the third student
$third = new Student();
$third->surname = "Parry";
$third->first_name = "Jim";
$third->add_grade(0);
$third->add_grade(40);
$third->add_email('work', 'jim_perry@bcit.ca');
//Add to array and sort
$students = array();
$students['j123'] = $first;
$students['a456'] = $second;
$students["b212"] = $third;
ksort($students);
//Display the students
foreach ($students as $student) {
echo $student->toString();
}
?>
</body>
</html>