3v4l.org

run code in 300+ PHP versions simultaneously
<?php function algorithm_a() { $data = [ 'city' => 'Lexington', 'name' => 'Mike Tyson', 'occupation' => 'Hot Dog Vendor', 'state' => 'KY', 'address' => '1009 Nicholasville Road', 'ZIP' => '40526' ]; $order = [ 'name', 'city', 'state' ]; $filtered = array_intersect_key( $data, array_flip($order) ); $ordered = array_merge( array_flip($order), $filtered ); return $ordered; } $result = algorithm_a(); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7k1Tl
function name:  (null)
number of ops:  7
compiled vars:  !0 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   INIT_FCALL                                               'algorithm_a'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   35     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function algorithm_a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7k1Tl
function name:  algorithm_a
number of ops:  20
compiled vars:  !0 = $data, !1 = $order, !2 = $filtered, !3 = $ordered
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, <array>
   15     1        ASSIGN                                                   !1, <array>
   21     2        INIT_FCALL                                               'array_intersect_key'
   22     3        SEND_VAR                                                 !0
   23     4        INIT_FCALL                                               'array_flip'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $6      
          7        SEND_VAR                                                 $6
          8        DO_ICALL                                         $7      
   21     9        ASSIGN                                                   !2, $7
   26    10        INIT_FCALL                                               'array_merge'
   27    11        INIT_FCALL                                               'array_flip'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $9      
         14        SEND_VAR                                                 $9
   28    15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $10     
   26    17        ASSIGN                                                   !3, $10
   31    18      > RETURN                                                   !3
   32    19*     > RETURN                                                   null

End of function algorithm_a

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.39 ms | 1399 KiB | 22 Q