开发者

Concerning PHP and Closures [closed]

开发者 https://www.devze.com 2023-03-20 12:32 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.
  • Are closures possible in PHP 5.3?
  • I'm looking for a simple closure example, minimal code is appreciated.
  • If closures are possible in PHP 5.3, does it behave similarly to Javascript's closures in terms of scopi开发者_运维知识库ng?
  • What are the difference between Javascript closures and PHP closures (if it exists)?


  • Are closures possible in PHP 5.3?

Yes

  • I'm looking for a simple closure example, minimal code is appreciated.
$text = "Hello World";
$closure = function () use ($text) { echo $text; }
$closure();
  • If closures are possible in PHP 5.3, does it behave similarly to Javascript's closures in terms of scoping?
  • What are the difference between Javascript closures and PHP closures (if it exists)?

Don't know. I never had a deeper look at JSs closures, but maybe you get an idea of whats PHPs closures are like after reading Wikipedia: Closure (Computer Science)

0

精彩评论

暂无评论...
验证码 换一张
取 消