<?php class emp { var $name; var $address; var $dept; function assign_info($n,$a,$d) { $this->name=$n; $this->state=$a; $this->dept=$d; } function display_info() { echo("<p>Employee Name : $this->name"); echo("<p>State : $this->state"); echo("<p>Department : $this->dept"); } } $empobj = new emp; $empobj->assign_info("kaka lname","California","Accounts"); echo("<center><h2>Displaying Employee Information</h2></center>"); echo("<font size=4>"); $empobj->display_info(); echo("</font>"); ?>
This is a php class to define and use. Friends who need it can download it and use it.
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

01 Nov 2024
Deprecated Java Methods and Classes: Usage GuidelinesDeveloping web applications in Eclipse often involves updating libraries and encountering...

11 Jan 2025
Utilizing Variables within Oracle SQL DeveloperIn SQL Developer, manipulating variables follows a distinct approach from other platforms like SQL...

21 Dec 2024
How to Use PDO Connection in Other Classes?Understanding the Puzzling ErrorAn error message stating "Uncaught Error: Call to undefined method...

27 Dec 2024
PHP Constant Arrays: Addressing the LimitationIn PHP, constants serve as placeholders for fixed values. However, assigning arrays to constants has...

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

03 Nov 2024
Exploring Constants in JavaScriptIn JavaScript, constants are immutable values that remain consistent throughout the execution of a program. While...


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
