普通网友 2011-07-13 13:09
浏览 110
已采纳

关于PHP和闭包[关闭]

  • 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 scoping?
  • What are the difference between Javascript closures and PHP closures (if it exists)?
  • 写回答

1条回答 默认 最新

  • doujue6196 2011-07-13 13:11
    关注
    • 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)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 matlab ode45 未发现警告,但是运行出错
  • ¥15 vscode platformio
  • ¥15 代写uni代码,app唤醒
  • ¥15 全志t113i启动qt应用程序提示internal error
  • ¥15 ensp可以看看嘛.
  • ¥80 51单片机C语言代码解决单片机为AT89C52是清翔单片机
  • ¥60 优博讯DT50高通安卓11系统刷完机自动进去fastboot模式
  • ¥15 minist数字识别
  • ¥15 在安装gym库的pygame时遇到问题,不知道如何解决
  • ¥20 uniapp中的webview 使用的是本地的vue页面,在模拟器上显示无法打开