请教php从哪个版本开始支持new $variable()实例化类

WBOY
Release: 2016-06-13 10:57:23
Original
810 people have browsed it

请问php从哪个版本开始支持new $variable()实例化类?
如题,使用变量指定一个类名,通过new实例对象,这是从php的哪个版本里开始支持的?
php手册里没找到,甚至连这种写法都没有看到。

------解决方案--------------------
这很早吧? php4 就有实例化类了啊。 $a=new b(); 或者 $a =new b;都可以
------解决方案--------------------
类与对象(PHP 4)继承类与对象(PHP 4)
PHP 手册

--------------------------------------------


类是变量与作用于这些变量的函数的集合。变量通过var来定义,函数通过 function 来定义,而类则通过下面的语法定义

------解决方案--------------------
php4
引入了类,就有了这种写法
------解决方案--------------------
4就带了

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!