3v4l.org

run code in 300+ PHP versions simultaneously
<?php header("Access-Control-Allow-Origin: *"); $json_string = '{ "nodes": [ { "id": "0", "type": "food" }, { "id": "1", "type": "drinks" }, { "id": "2", "type": "snacks" }, { "id": "3", "type": "food" }, { "id": "4", "type": "drinks" } ], "links": [ { "source": "0", "target": "1"}, { "source": "1", "target": "2"}, { "source": "2", "target": "0"} ] }'; // converts json_string to array $json = json_decode($json_string); printf("%s\n", json_encode($json, JSON_PRETTY_PRINT)); unset($json -> nodes[3]); printf("%s\n", json_encode($json, JSON_PRETTY_PRINT)); $json = array_values($json); $json = json_encode($json); printf("%s\n", $json) ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XPbuo
function name:  (null)
number of ops:  39
compiled vars:  !0 = $json_string, !1 = $json
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'header'
          1        SEND_VAL                                                 'Access-Control-Allow-Origin%3A+%2A'
          2        DO_ICALL                                                 
    5     3        ASSIGN                                                   !0, '%7B%0A++++++++%22nodes%22%3A+%5B%0A++++++++++++%7B+%22id%22%3A+%220%22%2C+%22type%22%3A+%22food%22+++%7D%2C%0A++++++++++++%7B+%22id%22%3A+%221%22%2C+%22type%22%3A+%22drinks%22+%7D%2C%0A++++++++++++%7B+%22id%22%3A+%222%22%2C+%22type%22%3A+%22snacks%22+%7D%2C%0A++++++++++++%7B+%22id%22%3A+%223%22%2C+%22type%22%3A+%22food%22+++%7D%2C%0A++++++++++++%7B+%22id%22%3A+%224%22%2C+%22type%22%3A+%22drinks%22+%7D%0A++++++++%5D%2C%0A++++++++%22links%22%3A+%5B%0A++++++++++++%7B+%22source%22%3A+%220%22%2C+%22target%22%3A+%221%22%7D%2C%0A++++++++++++%7B+%22source%22%3A+%221%22%2C+%22target%22%3A+%222%22%7D%2C%0A++++++++++++%7B+%22source%22%3A+%222%22%2C+%22target%22%3A+%220%22%7D%0A++++++++%5D%0A++++%7D'
   21     4        INIT_FCALL                                               'json_decode'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
   23     8        INIT_FCALL                                               'printf'
          9        SEND_VAL                                                 '%25s%0A'
         10        INIT_FCALL                                               'json_encode'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 128
         13        DO_ICALL                                         $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                                 
   25    16        FETCH_OBJ_UNSET                                  $8      !1, 'nodes'
         17        UNSET_DIM                                                $8, 3
   27    18        INIT_FCALL                                               'printf'
         19        SEND_VAL                                                 '%25s%0A'
         20        INIT_FCALL                                               'json_encode'
         21        SEND_VAR                                                 !1
         22        SEND_VAL                                                 128
         23        DO_ICALL                                         $9      
         24        SEND_VAR                                                 $9
         25        DO_ICALL                                                 
   30    26        INIT_FCALL                                               'array_values'
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                         $11     
         29        ASSIGN                                                   !1, $11
   33    30        INIT_FCALL                                               'json_encode'
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                         $13     
         33        ASSIGN                                                   !1, $13
   35    34        INIT_FCALL                                               'printf'
         35        SEND_VAL                                                 '%25s%0A'
         36        SEND_VAR                                                 !1
         37        DO_ICALL                                                 
   37    38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.69 ms | 1009 KiB | 18 Q