3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array('a' => 2, 'b' => 1, 'c' => 4); $first = array(key($array) => current($array)); $last = array_flip(array(end($array) => key($array))); $array = array_merge($last, array_slice($array,1,count($array) - 2), $first); print_r($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v6R7T
function name:  (null)
number of ops:  37
compiled vars:  !0 = $array, !1 = $first, !2 = $last
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'key'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $4      
          4        INIT_FCALL                                               'current'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $5      
          7        INIT_ARRAY                                       ~6      $5, $4
          8        ASSIGN                                                   !1, ~6
    5     9        INIT_FCALL                                               'array_flip'
         10        INIT_FCALL                                               'end'
         11        SEND_REF                                                 !0
         12        DO_ICALL                                         $8      
         13        INIT_FCALL                                               'key'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $9      
         16        INIT_ARRAY                                       ~10     $9, $8
         17        SEND_VAL                                                 ~10
         18        DO_ICALL                                         $11     
         19        ASSIGN                                                   !2, $11
    6    20        INIT_FCALL                                               'array_merge'
         21        SEND_VAR                                                 !2
         22        INIT_FCALL                                               'array_slice'
         23        SEND_VAR                                                 !0
         24        SEND_VAL                                                 1
         25        COUNT                                            ~13     !0
         26        SUB                                              ~14     ~13, 2
         27        SEND_VAL                                                 ~14
         28        DO_ICALL                                         $15     
         29        SEND_VAR                                                 $15
         30        SEND_VAR                                                 !1
         31        DO_ICALL                                         $16     
         32        ASSIGN                                                   !0, $16
    8    33        INIT_FCALL                                               'print_r'
         34        SEND_VAR                                                 !0
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.21 ms | 1396 KiB | 27 Q