Is it possible to simulate closures in PHP 5.2.x not using globals?

前端 未结 4 996
抹茶落季
抹茶落季 2020-12-17 22:38

Is it possible to simulate closures in PHP 5.2.x not using globals? I could think of a way that would pass the desired variables as extra parameters to the closure but that

4条回答
  •  太阳男子
    2020-12-17 22:47

    My solution: http://techblog.triptic.nl/simulating-closures-in-php-versions-prior-to-php-5-3/

    It does however pass the variables within an object to the closure as the first argument.

提交回复
热议问题