3v4l.org

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

Function %00%7Bclosure%7D%2Fin%2FDVXE4%3A19%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) 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%2FDVXE4%3A19%240

Class Paginator:
Function currentpage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) 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
1 jumps found. (Code = 62) 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 8.0.0


preferences:
220.59 ms | 1396 KiB | 15 Q