3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<XML <?xml version="1.0" encoding="utf-8"?> <toflag> <flagarea formulaid="1" eventid="100" sessionid="421" sectionid="180001" floorid="180001" zoneid="180001" categoryid="180001"> <flagbloc priceid="4410026">1</flagbloc> </flagarea> <flagarea formulaid="1" eventid="207" sessionid="423" sectionid="180001" floorid="180001" zoneid="180001" categoryid="180001"> <flagbloc priceid="4410026">1</flagbloc> </flagarea> <flagarea formulaid="1" eventid="94" sessionid="117" sectionid="170001" floorid="0" zoneid="170001" categoryid="170001"> <flagbloc priceid="4410026">1</flagbloc> </flagarea> <flagarea formulaid="1" eventid="120" sessionid="155" sectionid="170001" floorid="0" zoneid="170001" categoryid="170001"> <flagbloc priceid="4410026">1</flagbloc> </flagarea> </toflag> XML; $dom = new DOMDocument; $dom->loadXML($xml); $dom->formatOutput = true; $xpath = new DOMXpath($dom); $query = '/toflag/flagarea[@formulaid="1" and @eventid="207" and @sessionid="423" and @sectionid="180001" and @floorid="180001" and @zoneid="180001" and @categoryid="180001"]/flagbloc[@priceid="4410026"]'; $result = $xpath->query($query); if ($result->length) { $flagBloc = $result->item(0); var_dump($flagBloc->nodeValue); $flagBloc->nodeValue = intval($flagBloc->nodeValue, 10) + 1; } echo $dom->saveXML();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 36
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/hoN1q
function name:  (null)
number of ops:  40
compiled vars:  !0 = $xml, !1 = $dom, !2 = $xpath, !3 = $query, !4 = $result, !5 = $flagBloc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22utf-8%22%3F%3E%0A%3Ctoflag%3E%0A++++%3Cflagarea+formulaid%3D%221%22+eventid%3D%22100%22+sessionid%3D%22421%22+sectionid%3D%22180001%22+floorid%3D%22180001%22+zoneid%3D%22180001%22+categoryid%3D%22180001%22%3E%0A++++++++%3Cflagbloc+priceid%3D%224410026%22%3E1%3C%2Fflagbloc%3E%0A++++%3C%2Fflagarea%3E%0A++++%3Cflagarea+formulaid%3D%221%22+eventid%3D%22207%22+sessionid%3D%22423%22+sectionid%3D%22180001%22+floorid%3D%22180001%22+zoneid%3D%22180001%22+categoryid%3D%22180001%22%3E%0A++++++++%3Cflagbloc+priceid%3D%224410026%22%3E1%3C%2Fflagbloc%3E%0A++++%3C%2Fflagarea%3E%0A++++%3Cflagarea+formulaid%3D%221%22+eventid%3D%2294%22+sessionid%3D%22117%22+sectionid%3D%22170001%22+floorid%3D%220%22+zoneid%3D%22170001%22+categoryid%3D%22170001%22%3E%0A++++++++%3Cflagbloc+priceid%3D%224410026%22%3E1%3C%2Fflagbloc%3E%0A++++%3C%2Fflagarea%3E%0A++++%3Cflagarea+formulaid%3D%221%22+eventid%3D%22120%22+sessionid%3D%22155%22+sectionid%3D%22170001%22+floorid%3D%220%22+zoneid%3D%22170001%22+categoryid%3D%22170001%22%3E%0A++++++++%3Cflagbloc+priceid%3D%224410026%22%3E1%3C%2Fflagbloc%3E%0A++++%3C%2Fflagarea%3E%0A%3C%2Ftoflag%3E'
   20     1        NEW                                              $7      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $7
   21     4        INIT_METHOD_CALL                                         !1, 'loadXML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   22     7        ASSIGN_OBJ                                               !1, 'formatOutput'
          8        OP_DATA                                                  <true>
   24     9        NEW                                              $12     'DOMXpath'
         10        SEND_VAR_EX                                              !1
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $12
   25    13        ASSIGN                                                   !3, '%2Ftoflag%2Fflagarea%5B%40formulaid%3D%221%22+and+%40eventid%3D%22207%22+and+%40sessionid%3D%22423%22+and+%40sectionid%3D%22180001%22+and+%40floorid%3D%22180001%22+and+%40zoneid%3D%22180001%22+and+%40categoryid%3D%22180001%22%5D%2Fflagbloc%5B%40priceid%3D%224410026%22%5D'
   26    14        INIT_METHOD_CALL                                         !2, 'query'
         15        SEND_VAR_EX                                              !3
         16        DO_FCALL                                      0  $16     
         17        ASSIGN                                                   !4, $16
   27    18        FETCH_OBJ_R                                      ~18     !4, 'length'
         19      > JMPZ                                                     ~18, ->36
   28    20    >   INIT_METHOD_CALL                                         !4, 'item'
         21        SEND_VAL_EX                                              0
         22        DO_FCALL                                      0  $19     
         23        ASSIGN                                                   !5, $19
   29    24        INIT_FCALL                                               'var_dump'
         25        FETCH_OBJ_R                                      ~21     !5, 'nodeValue'
         26        SEND_VAL                                                 ~21
         27        DO_ICALL                                                 
   30    28        INIT_FCALL                                               'intval'
         29        FETCH_OBJ_R                                      ~24     !5, 'nodeValue'
         30        SEND_VAL                                                 ~24
         31        SEND_VAL                                                 10
         32        DO_ICALL                                         $25     
         33        ADD                                              ~26     $25, 1
         34        ASSIGN_OBJ                                               !5, 'nodeValue'
         35        OP_DATA                                                  ~26
   34    36    >   INIT_METHOD_CALL                                         !1, 'saveXML'
         37        DO_FCALL                                      0  $27     
         38        ECHO                                                     $27
         39      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.69 ms | 1400 KiB | 17 Q