Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
449 views
in Technique[技术] by (71.8m points)

php 中的闭包函数

比如说定义一个闭包函数$fn
$fn->call()
$fn instanceof Closure

这是对象的用法,难道说闭包函数即是函数也是对象?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Closure 类 是代表匿名函数的类
闭包函数作为变量的值来使用。PHP 会自动把此种表达式转换成内置类 Closure 的对象实例


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...