3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Paginator { private $currentPageResolver; public function currentPage() { return ($this->currentPageResolver)(); } public function setCurrentPageResolver(\Closure $resolver) { $this->currentPageResolver = $resolver; } } $paginator = new Paginator(); $paginator->setCurrentPageResolver(function () { return 12; }); $currentPage = $paginator->currentPage(); var_dump($currentPage);
based on DP8WE