How to create a new object in php

王林
Release: 2023-02-26 15:02:01
Original
5907 people have browsed it

How to create a new object in php

1. In PHP, if the variable value is a class name, you can directly new the variable, which is equivalent to the new class

$obj = new $class_name($aff_id,$this);
Copy after login

2. Traditional writing method

$obj = new LinkFeed($aff_id,$this);
Copy after login

Recommended tutorial: PHP video tutorial

The above is the detailed content of How to create a new object in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template