3v4l.org

run code in 300+ PHP versions simultaneously
<?php $address = array( "id" => 17570527.00, "seq" => 0, "line1" => "1 Heron Close", "line2" => "Bradwell", "post_town" => "Great Yarmouth", "county" => "Norfolk", "postcode" => "NR31 8LY", "mailsort" => "54136", "barcode" => "(NR318LY1AA)", "is_residential" => 1, "is_small_organisation" => 0, "is_large_organisation" => 0, ); function pluck_keys($array, ...$…) { return array_intersect_key($array, array_flip($…)); } echo implode("\n", pluck_keys($address, 'line1', 'line2', 'line3', 'line4', 'line5'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SPHkp
function name:  (null)
number of ops:  15
compiled vars:  !0 = $address
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   23     1        INIT_FCALL                                               'implode'
          2        SEND_VAL                                                 '%0A'
          3        INIT_FCALL                                               'pluck_keys'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 'line1'
          6        SEND_VAL                                                 'line2'
          7        SEND_VAL                                                 'line3'
          8        SEND_VAL                                                 'line4'
          9        SEND_VAL                                                 'line5'
         10        DO_FCALL                                      0  $2      
         11        SEND_VAR                                                 $2
         12        DO_ICALL                                         $3      
         13        ECHO                                                     $3
         14      > RETURN                                                   1

Function pluck_keys:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SPHkp
function name:  pluck_keys
number of ops:  11
compiled vars:  !0 = $array, !1 = $…
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV_VARIADIC                                    !1      
   20     2        INIT_FCALL                                               'array_intersect_key'
          3        SEND_VAR                                                 !0
          4        INIT_FCALL                                               'array_flip'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                         $3      
          9      > RETURN                                                   $3
   21    10*     > RETURN                                                   null

End of function pluck_keys

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164 ms | 1398 KiB | 20 Q