3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = <<<DATA {"foo": 1, "bar": "hello"} {"foo": 2, "bar": "cruel"} {"foo": 3, "bar": "world"} DATA; $output = '[' . preg_replace('/}\s*{/', '},{', $input) . ']'; echo $output;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KiOYk
function name:  (null)
number of ops:  11
compiled vars:  !0 = $input, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%22foo%22%3A+1%2C+%22bar%22%3A+%22hello%22%7D%0A%7B%22foo%22%3A+2%2C+%22bar%22%3A+%22cruel%22%7D%0A%7B%22foo%22%3A+3%2C+%22bar%22%3A+%22world%22%7D'
    9     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2F%7D%5Cs%2A%7B%2F'
          3        SEND_VAL                                                 '%7D%2C%7B'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $3      
          6        CONCAT                                           ~4      '%5B', $3
          7        CONCAT                                           ~5      ~4, '%5D'
          8        ASSIGN                                                   !1, ~5
   11     9        ECHO                                                     !1
         10      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.17 ms | 1394 KiB | 15 Q