<?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?

13Dec2024
Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...

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...

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:...

19Nov2024
Including Code in PHP Classes: Exploring Feasibility and AlternativesProblem:You seek to include methods from a separate file into your PHP class...

06Jul2016
I have seen many open source projects in the form of class.classname.php, but I have also seen many frameworks in the form of classname.class.php. Where should I place this class? I personally prefer the .class.php form, because in some frameworks, after importing third-party class libraries and specifying class libraries...


Hot Tools

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
