3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = Array ( 'user_id' => 10, 'id' => 2, 'user' => 'Nakiya', ); /** * Replace the keys in an array with another set. * * @param array $array The array * @param array $keys An array of keys matching the array's size * * @return array */ function replaceKeys($array, $keys) { $values = array_values($array); return array_combine($keys, $values); } var_dump(replaceKeys($array,array(1,2,3)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2AeF4
function name:  (null)
number of ops:  9
compiled vars:  !0 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   26     1        INIT_FCALL                                                   'var_dump'
          2        INIT_FCALL                                                   'replacekeys'
          3        SEND_VAR                                                     !0
          4        SEND_VAL                                                     <array>
          5        DO_FCALL                                          0  $2      
          6        SEND_VAR                                                     $2
          7        DO_ICALL                                                     
          8      > RETURN                                                       1

Function replacekeys:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2AeF4
function name:  replaceKeys
number of ops:  12
compiled vars:  !0 = $array, !1 = $keys, !2 = $values
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   20     2        INIT_FCALL                                                   'array_values'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $3      
          5        ASSIGN                                                       !2, $3
   22     6        INIT_FCALL                                                   'array_combine'
          7        SEND_VAR                                                     !1
          8        SEND_VAR                                                     !2
          9        DO_ICALL                                             $5      
         10      > RETURN                                                       $5
   23    11*     > RETURN                                                       null

End of function replacekeys

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
215.26 ms | 2097 KiB | 17 Q