3v4l.org

run code in 300+ PHP versions simultaneously
<?php $jsonString = '[{"value":"jquery"},{"value":"bootstrap"}]'; $array = json_decode($jsonString); $array2 = array_column($array, "value"); $csv = implode(", ", $array2); echo "Comma Separated String: ", $csv, "\n"; $array3 = explode(", ", $csv); $array4 = array_map(function ($val){ $obj = (object)[]; $obj->value=$val; return $obj; }, $array3); $jsonString2 = json_encode($array4); echo "Json String: ", $jsonString2;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t5vtg
function name:  (null)
number of ops:  36
compiled vars:  !0 = $jsonString, !1 = $array, !2 = $array2, !3 = $csv, !4 = $array3, !5 = $array4, !6 = $jsonString2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5B%7B%22value%22%3A%22jquery%22%7D%2C%7B%22value%22%3A%22bootstrap%22%7D%5D'
    4     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $8      
          4        ASSIGN                                                   !1, $8
    5     5        INIT_FCALL                                               'array_column'
          6        SEND_VAR                                                 !1
          7        SEND_VAL                                                 'value'
          8        DO_ICALL                                         $10     
          9        ASSIGN                                                   !2, $10
    6    10        INIT_FCALL                                               'implode'
         11        SEND_VAL                                                 '%2C+'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $12     
         14        ASSIGN                                                   !3, $12
    7    15        ECHO                                                     'Comma+Separated+String%3A+'
         16        ECHO                                                     !3
         17        ECHO                                                     '%0A'
    9    18        INIT_FCALL                                               'explode'
         19        SEND_VAL                                                 '%2C+'
         20        SEND_VAR                                                 !3
         21        DO_ICALL                                         $14     
         22        ASSIGN                                                   !4, $14
   10    23        INIT_FCALL                                               'array_map'
         24        DECLARE_LAMBDA_FUNCTION                          ~16     [0]
   14    25        SEND_VAL                                                 ~16
         26        SEND_VAR                                                 !4
   10    27        DO_ICALL                                         $17     
         28        ASSIGN                                                   !5, $17
   15    29        INIT_FCALL                                               'json_encode'
         30        SEND_VAR                                                 !5
         31        DO_ICALL                                         $19     
         32        ASSIGN                                                   !6, $19
   16    33        ECHO                                                     'Json+String%3A+'
         34        ECHO                                                     !6
   17    35      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t5vtg
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $val, !1 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        CAST                                          8  ~2      <array>
          2        ASSIGN                                                   !1, ~2
   12     3        ASSIGN_OBJ                                               !1, 'value'
          4        OP_DATA                                                  !0
   13     5      > RETURN                                                   !1
   14     6*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.46 ms | 1021 KiB | 19 Q