3v4l.org

run code in 500+ PHP versions simultaneously
<?php # read config file data from the file using file_get_contents $string = '{ "mysql": { "host": "locahost", "port": 3306, "database": "test", "username": "root", "password": "" } }'; $cfg = json_decode($string,1); # decode the result as an array $host = $cfg["mysql"]["host"]; $port = $cfg["mysql"]["port"]; $database = $cfg["mysql"]["database"]; $username = $cfg["mysql"]["username"]; $password = $cfg["mysql"]["password"]; echo "host = $host, port = $port, database=$database, username=$username, password=$password"; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qN35T
function name:  (null)
number of ops:  33
compiled vars:  !0 = $string, !1 = $cfg, !2 = $host, !3 = $port, !4 = $database, !5 = $username, !6 = $password
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                       !0, '%7B%0A++%22mysql%22%3A+%7B%0A++++%22host%22%3A+%22locahost%22%2C%0A++++%22port%22%3A+3306%2C%0A++++%22database%22%3A+%22test%22%2C%0A++++%22username%22%3A+%22root%22%2C%0A++++%22password%22%3A+%22%22%0A++%7D%0A%7D'
   14     1        INIT_FCALL                                                   'json_decode'
          2        SEND_VAR                                                     !0
          3        SEND_VAL                                                     1
          4        DO_ICALL                                             $8      
          5        ASSIGN                                                       !1, $8
   16     6        FETCH_DIM_R                                          ~10     !1, 'mysql'
          7        FETCH_DIM_R                                          ~11     ~10, 'host'
          8        ASSIGN                                                       !2, ~11
   17     9        FETCH_DIM_R                                          ~13     !1, 'mysql'
         10        FETCH_DIM_R                                          ~14     ~13, 'port'
         11        ASSIGN                                                       !3, ~14
   18    12        FETCH_DIM_R                                          ~16     !1, 'mysql'
         13        FETCH_DIM_R                                          ~17     ~16, 'database'
         14        ASSIGN                                                       !4, ~17
   19    15        FETCH_DIM_R                                          ~19     !1, 'mysql'
         16        FETCH_DIM_R                                          ~20     ~19, 'username'
         17        ASSIGN                                                       !5, ~20
   20    18        FETCH_DIM_R                                          ~22     !1, 'mysql'
         19        FETCH_DIM_R                                          ~23     ~22, 'password'
         20        ASSIGN                                                       !6, ~23
   21    21        ROPE_INIT                                        10  ~26     'host+%3D+'
         22        ROPE_ADD                                          1  ~26     ~26, !2
         23        ROPE_ADD                                          2  ~26     ~26, '%2C+port+%3D+'
         24        ROPE_ADD                                          3  ~26     ~26, !3
         25        ROPE_ADD                                          4  ~26     ~26, '%2C+database%3D'
         26        ROPE_ADD                                          5  ~26     ~26, !4
         27        ROPE_ADD                                          6  ~26     ~26, '%2C+username%3D'
         28        ROPE_ADD                                          7  ~26     ~26, !5
         29        ROPE_ADD                                          8  ~26     ~26, '%2C+password%3D'
         30        ROPE_END                                          9  ~25     ~26, !6
         31        ECHO                                                         ~25
   22    32      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
221.16 ms | 2106 KiB | 14 Q