Home  >  Article  >  Backend Development  >  How to create a new object in php

How to create a new object in php

王林
王林Original
2019-10-14 11:49:085906browse

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);

2. Traditional writing method

$obj = new LinkFeed($aff_id,$this);

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!

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