3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<XML <?xml version="1.0" encoding="utf-8"?> <touhou xmlns:windows="http://example.com/windows" xmlns:alt="http://example.com/alt"> <!-- included in json --> <game> <title lang="en">Highly Responsive to Prayers</title> <title lang="jp">東方靈異伝</title> </game> <game> <title lang="en">Story of Eastern Wonderland</title> <!-- the romaji attribute won't be included in json --> <title lang="jp" alt:romaji="Tōhō Fūmaroku">東方封魔録</title> </game> <!-- won't be included in json --> <windows:game> <title lang="en">Embodiment of Scarlet Devil</title> <title lang="jp">東方紅魔郷</title> </windows:game> <windows:game> <title lang="en">Perfect Cherry Blossom</title> <title lang="jp">東方妖々夢</title> </windows:game> </touhou> XML; $result = json_decode(json_encode(new SimpleXMLElement($xml)), true); var_dump($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XOfVX
function name:  (null)
number of ops:  16
compiled vars:  !0 = $xml, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22utf-8%22%3F%3E%0A%3Ctouhou+xmlns%3Awindows%3D%22http%3A%2F%2Fexample.com%2Fwindows%22+xmlns%3Aalt%3D%22http%3A%2F%2Fexample.com%2Falt%22%3E%0A+++%3C%21--+included+in+json+--%3E%0A+++%3Cgame%3E%0A++++++%3Ctitle+lang%3D%22en%22%3EHighly+Responsive+to+Prayers%3C%2Ftitle%3E%0A++++++%3Ctitle+lang%3D%22jp%22%3E%E6%9D%B1%E6%96%B9%E9%9D%88%E7%95%B0%E4%BC%9D%3C%2Ftitle%3E%0A+++%3C%2Fgame%3E%0A+++%3Cgame%3E%0A++++++%3Ctitle+lang%3D%22en%22%3EStory+of+Eastern+Wonderland%3C%2Ftitle%3E%0A++++++%3C%21--+the+romaji+attribute+won%27t+be+included+in+json+--%3E%0A++++++%3Ctitle+lang%3D%22jp%22+alt%3Aromaji%3D%22T%C5%8Dh%C5%8D+F%C5%ABmaroku%22%3E%E6%9D%B1%E6%96%B9%E5%B0%81%E9%AD%94%E9%8C%B2%3C%2Ftitle%3E%0A+++%3C%2Fgame%3E%0A+++%3C%21--+won%27t+be+included+in+json+--%3E%0A+++%3Cwindows%3Agame%3E%0A++++++%3Ctitle+lang%3D%22en%22%3EEmbodiment+of+Scarlet+Devil%3C%2Ftitle%3E%0A++++++%3Ctitle+lang%3D%22jp%22%3E%E6%9D%B1%E6%96%B9%E7%B4%85%E9%AD%94%E9%83%B7%3C%2Ftitle%3E%0A+++%3C%2Fwindows%3Agame%3E%0A+++%3Cwindows%3Agame%3E%0A++++++%3Ctitle+lang%3D%22en%22%3EPerfect+Cherry+Blossom%3C%2Ftitle%3E%0A++++++%3Ctitle+lang%3D%22jp%22%3E%E6%9D%B1%E6%96%B9%E5%A6%96%E3%80%85%E5%A4%A2%3C%2Ftitle%3E%0A+++%3C%2Fwindows%3Agame%3E%0A%3C%2Ftouhou%3E%0A'
   30     1        INIT_FCALL                                               'json_decode'
          2        INIT_FCALL                                               'json_encode'
          3        NEW                                              $3      'SimpleXMLElement'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                         $5      
          8        SEND_VAR                                                 $5
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $6      
         11        ASSIGN                                                   !1, $6
   31    12        INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.13 ms | 1395 KiB | 19 Q