3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(1 => '5ive', 'jim' => 'bob', 4 => 5); end($array); echo 'Pointer is set to: ' . current($array) . "\n"; var_dump(array_slice($array, 0, 1)); echo 'first item: ' . array_slice($array, 0, 1)[0] . "\n"; echo 'Pointer is set to: ' . current($array) . "\n"; var_dump($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v7LdR
function name:  (null)
number of ops:  37
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'end'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                                 
    6     4        INIT_FCALL                                               'current'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        CONCAT                                           ~4      'Pointer+is+set+to%3A+', $3
          8        CONCAT                                           ~5      ~4, '%0A'
          9        ECHO                                                     ~5
    8    10        INIT_FCALL                                               'var_dump'
         11        INIT_FCALL                                               'array_slice'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 0
         14        SEND_VAL                                                 1
         15        DO_ICALL                                         $6      
         16        SEND_VAR                                                 $6
         17        DO_ICALL                                                 
   10    18        INIT_FCALL                                               'array_slice'
         19        SEND_VAR                                                 !0
         20        SEND_VAL                                                 0
         21        SEND_VAL                                                 1
         22        DO_ICALL                                         $8      
         23        FETCH_DIM_R                                      ~9      $8, 0
         24        CONCAT                                           ~10     'first+item%3A+', ~9
         25        CONCAT                                           ~11     ~10, '%0A'
         26        ECHO                                                     ~11
   12    27        INIT_FCALL                                               'current'
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                         $12     
         30        CONCAT                                           ~13     'Pointer+is+set+to%3A+', $12
         31        CONCAT                                           ~14     ~13, '%0A'
         32        ECHO                                                     ~14
   13    33        INIT_FCALL                                               'var_dump'
         34        SEND_VAR                                                 !0
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.64 ms | 1400 KiB | 21 Q