3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text ='{"success":true,"result":[{"product_id":"","faq_no":"FAQ1","faqcategories":"General","faqstatus":"Published","question":"\u062a\u0633\u062a \u062f\u0627\u0631\u061f","faq_answer":"\u0646\u062f\u0627\u0631\u062f","createdtime":"2017-11-20 08:35:47","modifiedtime":"2017-11-20 08:35:47","modifiedby":"19x1","source":"CRM","starred":"0","tags":"","id":"3x12"}]}'; function cleanjson($text){ $newjson = explode("{",$text); $newjsonrightclean="{".$newjson[1]."{".$newjson[2]; $newjson2 = explode("}}",$newjsonrightclean); if ($newjson2[0] != ''){ $out = $newjson2[0]."}}"; }else{ $newjson2 = explode("]}",$newjsonrightclean); $out = $newjson2[0]."]}"; } return $out; } echo cleanjson($text) ;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EmiSo
function name:  (null)
number of ops:  6
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%22success%22%3Atrue%2C%22result%22%3A%5B%7B%22product_id%22%3A%22%22%2C%22faq_no%22%3A%22FAQ1%22%2C%22faqcategories%22%3A%22General%22%2C%22faqstatus%22%3A%22Published%22%2C%22question%22%3A%22%5Cu062a%5Cu0633%5Cu062a+%5Cu062f%5Cu0627%5Cu0631%5Cu061f%22%2C%22faq_answer%22%3A%22%5Cu0646%5Cu062f%5Cu0627%5Cu0631%5Cu062f%22%2C%22createdtime%22%3A%222017-11-20+08%3A35%3A47%22%2C%22modifiedtime%22%3A%222017-11-20+08%3A35%3A47%22%2C%22modifiedby%22%3A%2219x1%22%2C%22source%22%3A%22CRM%22%2C%22starred%22%3A%220%22%2C%22tags%22%3A%22%22%2C%22id%22%3A%223x12%22%7D%5D%7D'
   20     1        INIT_FCALL                                               'cleanjson'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function cleanjson:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EmiSo
function name:  cleanjson
number of ops:  34
compiled vars:  !0 = $text, !1 = $newjson, !2 = $newjsonrightclean, !3 = $newjson2, !4 = $out
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%7B'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
    8     6        FETCH_DIM_R                                      ~7      !1, 1
          7        CONCAT                                           ~8      '%7B', ~7
          8        CONCAT                                           ~9      ~8, '%7B'
          9        FETCH_DIM_R                                      ~10     !1, 2
         10        CONCAT                                           ~11     ~9, ~10
         11        ASSIGN                                                   !2, ~11
    9    12        INIT_FCALL                                               'explode'
         13        SEND_VAL                                                 '%7D%7D'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $13     
         16        ASSIGN                                                   !3, $13
   10    17        FETCH_DIM_R                                      ~15     !3, 0
         18        IS_NOT_EQUAL                                             ~15, ''
         19      > JMPZ                                                     ~16, ->24
   11    20    >   FETCH_DIM_R                                      ~17     !3, 0
         21        CONCAT                                           ~18     ~17, '%7D%7D'
         22        ASSIGN                                                   !4, ~18
         23      > JMP                                                      ->32
   13    24    >   INIT_FCALL                                               'explode'
         25        SEND_VAL                                                 '%5D%7D'
         26        SEND_VAR                                                 !2
         27        DO_ICALL                                         $20     
         28        ASSIGN                                                   !3, $20
   14    29        FETCH_DIM_R                                      ~22     !3, 0
         30        CONCAT                                           ~23     ~22, '%5D%7D'
         31        ASSIGN                                                   !4, ~23
   16    32    > > RETURN                                                   !4
   18    33*     > RETURN                                                   null

End of function cleanjson

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.63 ms | 1403 KiB | 16 Q