3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ComicNav { public function __construct( public string $first, public ?string $prev, public string $current, public ?string $next, public string $last ) { } } function get_nav(string $file): ComicNav { $files = array_map( 'basename', glob(dirname($file).'/*.php') ); $current = basename($file); $next = $files[array_search($current, $files) + 1] ?? null; $prev = $files[array_search($current, $files) - 1] ?? null; return new ComicNav( reset($files), $prev, $current, $next, end($files) ); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jqesd
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E > > RETURN                                                   1

Function get_nav:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jqesd
function name:  get_nav
number of ops:  52
compiled vars:  !0 = $file, !1 = $files, !2 = $current, !3 = $next, !4 = $prev
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        INIT_FCALL                                               'array_map'
   18     2        SEND_VAL                                                 'basename'
   19     3        INIT_FCALL                                               'glob'
          4        INIT_FCALL                                               'dirname'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $5      
          7        CONCAT                                           ~6      $5, '%2F%2A.php'
          8        SEND_VAL                                                 ~6
          9        DO_ICALL                                         $7      
         10        SEND_VAR                                                 $7
   17    11        DO_ICALL                                         $8      
         12        ASSIGN                                                   !1, $8
   22    13        INIT_FCALL                                               'basename'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $10     
         16        ASSIGN                                                   !2, $10
   23    17        INIT_FCALL                                               'array_search'
         18        SEND_VAR                                                 !2
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $12     
         21        ADD                                              ~13     $12, 1
         22        FETCH_DIM_IS                                     ~14     !1, ~13
         23        COALESCE                                         ~15     ~14
         24        QM_ASSIGN                                        ~15     null
         25        ASSIGN                                                   !3, ~15
   24    26        INIT_FCALL                                               'array_search'
         27        SEND_VAR                                                 !2
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                         $17     
         30        SUB                                              ~18     $17, 1
         31        FETCH_DIM_IS                                     ~19     !1, ~18
         32        COALESCE                                         ~20     ~19
         33        QM_ASSIGN                                        ~20     null
         34        ASSIGN                                                   !4, ~20
   26    35        NEW                                              $22     'ComicNav'
   27    36        INIT_FCALL                                               'reset'
         37        SEND_REF                                                 !1
         38        DO_ICALL                                         $23     
         39        SEND_VAR_NO_REF_EX                                       $23
         40        SEND_VAR_EX                                              !4
         41        SEND_VAR_EX                                              !2
         42        SEND_VAR_EX                                              !3
   31    43        INIT_FCALL                                               'end'
         44        SEND_REF                                                 !1
         45        DO_ICALL                                         $24     
         46        SEND_VAR_NO_REF_EX                                       $24
   26    47        DO_FCALL                                      0          
   31    48        VERIFY_RETURN_TYPE                                       $22
         49      > RETURN                                                   $22
   33    50*       VERIFY_RETURN_TYPE                                       
         51*     > RETURN                                                   null

End of function get_nav

Class ComicNav:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jqesd
function name:  __construct
number of ops:  16
compiled vars:  !0 = $first, !1 = $prev, !2 = $current, !3 = $next, !4 = $last
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
          5        ASSIGN_OBJ                                               'first'
          6        OP_DATA                                                  !0
          7        ASSIGN_OBJ                                               'prev'
          8        OP_DATA                                                  !1
          9        ASSIGN_OBJ                                               'current'
         10        OP_DATA                                                  !2
         11        ASSIGN_OBJ                                               'next'
         12        OP_DATA                                                  !3
         13        ASSIGN_OBJ                                               'last'
         14        OP_DATA                                                  !4
   12    15      > RETURN                                                   null

End of function __construct

End of class ComicNav.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.55 ms | 1016 KiB | 20 Q