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
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/DVXE4
function name:  (null)
number of ops:  15
compiled vars:  !0 = $paginator, !1 = $currentPage
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  18     1        NEW                                              $3      :-6
         2        DO_FCALL                                      0          
         3        ASSIGN                                                   !0, $3
  19     4        INIT_METHOD_CALL                                         !0, 'setCurrentPageResolver'
         5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FDVXE40x7f864dd16186'
  21     6        SEND_VAL_EX                                              ~6
         7        DO_FCALL                                      0          
  22     8        INIT_METHOD_CALL                                         !0, 'currentPage'
         9        DO_FCALL                                      0  $8      
        10        ASSIGN                                                   !1, $8
  23    11        INIT_FCALL                                               'var_dump'
        12        SEND_VAR                                                 !1
        13        DO_ICALL                                                 
        14      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FDVXE40x7f864dd16186:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/DVXE4
function name:  {closure}
number of ops:  2
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  20     0  E > > RETURN                                                   12
  21     1*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FDVXE40x7f864dd16186

Class Paginator:
Function currentpage:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/DVXE4
function name:  currentPage
number of ops:  5
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   9     0  E >   FETCH_OBJ_R                                      $0      'currentPageResolver'
         1        INIT_DYNAMIC_CALL                                        $0
         2        DO_FCALL                                      0  $1      
         3      > RETURN                                                   $1
  10     4*     > RETURN                                                   null

End of function currentpage

Function setcurrentpageresolver:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/DVXE4
function name:  setCurrentPageResolver
number of ops:  4
compiled vars:  !0 = $resolver
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  12     0  E >   RECV                                             !0      
  14     1        ASSIGN_OBJ                                               'currentPageResolver'
         2        OP_DATA                                                  !0
  15     3      > RETURN                                                   null

End of function setcurrentpageresolver

End of class Paginator.

Generated using Vulcan Logic Dumper, using php 7.1.0