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(array_flip(array(end($array) => key($array))), 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/MkFVY
function name:  (null)
number of ops:  36
compiled vars:  !0 = $array, !1 = $first
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                                         $3      
          4        INIT_FCALL                                               'current'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
          7        INIT_ARRAY                                       ~5      $4, $3
          8        ASSIGN                                                   !1, ~5
    6     9        INIT_FCALL                                               'array_merge'
         10        INIT_FCALL                                               'array_flip'
         11        INIT_FCALL                                               'end'
         12        SEND_REF                                                 !0
         13        DO_ICALL                                         $7      
         14        INIT_FCALL                                               'key'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $8      
         17        INIT_ARRAY                                       ~9      $8, $7
         18        SEND_VAL                                                 ~9
         19        DO_ICALL                                         $10     
         20        SEND_VAR                                                 $10
         21        INIT_FCALL                                               'array_slice'
         22        SEND_VAR                                                 !0
         23        SEND_VAL                                                 1
         24        COUNT                                            ~11     !0
         25        SUB                                              ~12     ~11, 2
         26        SEND_VAL                                                 ~12
         27        DO_ICALL                                         $13     
         28        SEND_VAR                                                 $13
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                         $14     
         31        ASSIGN                                                   !0, $14
    8    32        INIT_FCALL                                               'print_r'
         33        SEND_VAR                                                 !0
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.8 ms | 1388 KiB | 27 Q