3v4l.org

run code in 300+ PHP versions simultaneously
<?php $index_norm = array("key1" => "foobar", "key2" => "bananaramam", "key3" => "spam"); $result = array( "ids"=>array_keys($index_norm), "weights"=>array_values($index_norm) ); $json = json_encode($result); echo $json.PHP_EOL; $decoded = json_decode($json, true); var_dump($decoded); echo json_encode($decoded);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FVurh
function name:  (null)
number of ops:  29
compiled vars:  !0 = $index_norm, !1 = $result, !2 = $json, !3 = $decoded
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'array_keys'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        INIT_ARRAY                                       ~6      $5, 'ids'
    6     5        INIT_FCALL                                               'array_values'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $7      
          8        ADD_ARRAY_ELEMENT                                ~6      $7, 'weights'
    4     9        ASSIGN                                                   !1, ~6
    9    10        INIT_FCALL                                               'json_encode'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $9      
         13        ASSIGN                                                   !2, $9
   11    14        CONCAT                                           ~11     !2, '%0A'
         15        ECHO                                                     ~11
   13    16        INIT_FCALL                                               'json_decode'
         17        SEND_VAR                                                 !2
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $12     
         20        ASSIGN                                                   !3, $12
   15    21        INIT_FCALL                                               'var_dump'
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                                 
   17    24        INIT_FCALL                                               'json_encode'
         25        SEND_VAR                                                 !3
         26        DO_ICALL                                         $15     
         27        ECHO                                                     $15
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.11 ms | 1395 KiB | 23 Q