<?php class Student { var $str_Name; var $str_Sex; var $int_Id; var $int_English; var $int_maths; function Input ( $Name, $Sex, $Id, $English, $Maths) { $this->str_Name=$Name; $this->str_Sex =$Sex; $this->int_Id =$Id; $this->int_English=$English; $this->int_Maths=$Maths; } function ShowInfo() { echo ("姓名:$this->str_Name<br> "); echo ("性别:$this->str_Sex <br> "); echo ("学号:$this->int_Id <br> "); echo ("英语成绩:$this->int_English <br> "); echo ("数学成绩:$this->int_Maths <br> "); } } $Wing = new Student; $Wing->Input ("Wing","男",33,95,87); $Paladin = new Student; $Paladin->Input ("paladin","女",38,58,59.5); $Wing->ShowInfo(); $Paladin->ShowInfo(); ?>
Defines the human class, including name, gender, student number, English score, math score, etc.
All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn
Related Article
06Jul2016
What are some very useful class libraries or tool libraries for PHP?
![How Do I Link Static Libraries That Depend on Other Static Libraries?](https://img.php.cn/upload/article/001/246/273/173408941480807.jpg)
13Dec2024
Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...
![Can I Include Code Directly Inside a PHP Class Definition?](https://img.php.cn/upload/article/001/246/273/173196792419832.jpg)
19Nov2024
Can I Include Code into a PHP Class?The Answer:No, you cannot directly include code within the body of a class in PHP. Inclusions must be...
![Can I Include External Files Directly Inside a PHP Class Definition?](https://img.php.cn/upload/article/001/246/273/173258581037739.jpg)
26Nov2024
Can I Include Code into a PHP Class?Question: Is it possible to include an external file containing method definitions into a PHP class?Answer:...
![How Can I Include External Methods into My PHP Class Definition?](https://img.php.cn/upload/article/001/246/273/173201748345633.jpg)
19Nov2024
Including Code in PHP Classes: Exploring Feasibility and AlternativesProblem:You seek to include methods from a separate file into your PHP class...
![Why Do PHP Developers Use Leading Underscores in Class Methods?](https://img.php.cn/upload/article/001/246/273/173126370362701.jpg)
11Nov2024
Hidden Truths: The Leading Underscore in PHP Class MethodsWhen browsing PHP libraries, one might stumble upon class methods prefixed with a...
![](/static/imghwm/down_right.png)
![](/static/imghwm/taglogo.png)
Hot Tools
![PHP library for dependency injection containers](https://img.php.cn/upload/manual/000/000/001/5e21721e79a2b232.png)
PHP library for dependency injection containers
PHP library for dependency injection containers
A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking
Small PHP library for optimizing images
Small PHP library for optimizing images
![](/static/imghwm/taglogo.png)