3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array('clientId' => 5, 'userId'=>12); $name_map = array( 'clientId' => 'cid', 'userId' => 'uid', 'eventCategory' => 'ec', 'eventAction' => 'ea', 'eventLabel' => 'el', 'eventValue' => 'ev', 'nonInteraction' => 'ni', 'nonInteractive' => 'ni', 'documentPath' => 'dp', 'documentTitle' => 'dt', 'title' => 'dt', 'path' => 'dp', 'page' => 'dp', 'location' => 'dl', 'documentLocation' => 'dl', 'hostname' => 'dh', 'documentHostname' => 'dh', 'sessionControl' => 'sc', 'referrer' => 'dr', 'documentReferrer' => 'dr', 'queueTime' => 'qt', 'campaignName' => 'cn', 'campaignSource' => 'cs', 'campaignMedium' => 'cm', 'campaignKeyword' => 'ck', 'campaignContent' => 'cc', 'campaignId' => 'ci', 'screenResolution' => 'sr', 'viewportSize' => 'vp', 'documentEncoding' => 'de', 'screenColors' => 'sd', 'userLanguage' => 'ul', 'appName' => 'an', 'contentDescription' => 'cd', 'appVersion' => 'av', 'transactionAffiliation' => 'ta', 'transactionId' => 'ti', 'transactionRevenue' => 'tr', 'transactionShipping' => 'ts', 'transactionTax' => 'tt', 'transactionCurrency' => 'cu', 'itemName' => 'in', 'itemPrice' => 'ip', 'itemQuantity' => 'iq', 'itemCode' => 'ic', 'itemVariation' => 'iv', 'itemCategory' => 'iv', 'socialAction' => 'sa', 'socialNetwork' => 'sn', 'socialTarget' => 'st', 'exceptionDescription' => 'exd', 'exceptionFatal' => 'exf', 'timingCategory' => 'utc', 'timingVariable' => 'utv', 'timingTime' => 'utt', 'timingLabel' => 'utl', 'timingDNS' => 'dns', 'timingPageLoad' => 'pdt', 'timingRedirect' => 'rrt', 'timingTCPConnect' => 'tcp', 'timingServerResponse' => 'srt' ); $name_map_re = array( '@^dimension([0-9]+)$@' => 'cd$1', '@^metric([0-9]+)$@' => 'cm$1' ); $result_keys_in = array_keys($data); $result_keys = str_replace(array_keys($name_map), array_values($name_map), $result_keys_in); $result_keys = preg_replace(array_keys($name_map_re), array_values($name_map_re), $result_keys); var_dump($result_keys);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T8CaP
function name:  (null)
number of ops:  35
compiled vars:  !0 = $data, !1 = $name_map, !2 = $name_map_re, !3 = $result_keys_in, !4 = $result_keys
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
   67     2        ASSIGN                                                   !2, <array>
   71     3        INIT_FCALL                                               'array_keys'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !3, $8
   72     7        INIT_FCALL                                               'str_replace'
          8        INIT_FCALL                                               'array_keys'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $10     
         11        SEND_VAR                                                 $10
         12        INIT_FCALL                                               'array_values'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $11     
         15        SEND_VAR                                                 $11
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                         $12     
         18        ASSIGN                                                   !4, $12
   73    19        INIT_FCALL                                               'preg_replace'
         20        INIT_FCALL                                               'array_keys'
         21        SEND_VAR                                                 !2
         22        DO_ICALL                                         $14     
         23        SEND_VAR                                                 $14
         24        INIT_FCALL                                               'array_values'
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                         $15     
         27        SEND_VAR                                                 $15
         28        SEND_VAR                                                 !4
         29        DO_ICALL                                         $16     
         30        ASSIGN                                                   !4, $16
   74    31        INIT_FCALL                                               'var_dump'
         32        SEND_VAR                                                 !4
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.54 ms | 1396 KiB | 23 Q