3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start = microtime(true); $json_1 = '[{"MobileNo":"123"},{"MobileNo":"456"}]'; $json_2 = '[{"MobileNo":"07123456701"}]'; $multiple = json_decode($json_1, true); $doc = new DOMDocument(); $doc->formatOutput = true; $root = $doc->createElement("Msg"); $doc->appendChild($root); $root->appendChild($doc->createElement("JobId", 77)); foreach ($multiple as $mobile) { $result = $doc->createElement("SubmitResult"); $result->appendChild($doc->createElement("MobileNo", $mobile["MobileNo"])); $result->appendChild($doc->createElement("StatusId", 0)); $result->appendChild($doc->createElement("StatusText", "Success: Message submitted successfully")); $root->appendChild($result); } $doc->saveXML(); $stop = microtime(true); $seconds = $stop - $start; echo "Start: " . $start . PHP_EOL; echo "Stop: " . $stop . PHP_EOL; echo "Seconds: " . $seconds . PHP_EOL; echo "Memory peak: " . memory_get_peak_usage() / 1048576 . 'MB' . PHP_EOL;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 31, Position 2 = 63
Branch analysis from position: 31
2 jumps found. (Code = 78) Position 1 = 32, Position 2 = 63
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 63
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 63
filename:       /in/q8bgl
function name:  (null)
number of ops:  89
compiled vars:  !0 = $start, !1 = $json_1, !2 = $json_2, !3 = $multiple, !4 = $doc, !5 = $root, !6 = $mobile, !7 = $result, !8 = $stop, !9 = $seconds
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'microtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $10     
          3        ASSIGN                                                   !0, $10
    4     4        ASSIGN                                                   !1, '%5B%7B%22MobileNo%22%3A%22123%22%7D%2C%7B%22MobileNo%22%3A%22456%22%7D%5D'
    5     5        ASSIGN                                                   !2, '%5B%7B%22MobileNo%22%3A%2207123456701%22%7D%5D'
    7     6        INIT_FCALL                                               'json_decode'
          7        SEND_VAR                                                 !1
          8        SEND_VAL                                                 <true>
          9        DO_ICALL                                         $14     
         10        ASSIGN                                                   !3, $14
    9    11        NEW                                              $16     'DOMDocument'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !4, $16
   10    14        ASSIGN_OBJ                                               !4, 'formatOutput'
         15        OP_DATA                                                  <true>
   12    16        INIT_METHOD_CALL                                         !4, 'createElement'
         17        SEND_VAL_EX                                              'Msg'
         18        DO_FCALL                                      0  $20     
         19        ASSIGN                                                   !5, $20
   13    20        INIT_METHOD_CALL                                         !4, 'appendChild'
         21        SEND_VAR_EX                                              !5
         22        DO_FCALL                                      0          
   14    23        INIT_METHOD_CALL                                         !5, 'appendChild'
         24        INIT_METHOD_CALL                                         !4, 'createElement'
         25        SEND_VAL_EX                                              'JobId'
         26        SEND_VAL_EX                                              77
         27        DO_FCALL                                      0  $23     
         28        SEND_VAR_NO_REF_EX                                       $23
         29        DO_FCALL                                      0          
   16    30      > FE_RESET_R                                       $25     !3, ->63
         31    > > FE_FETCH_R                                               $25, !6, ->63
   17    32    >   INIT_METHOD_CALL                                         !4, 'createElement'
         33        SEND_VAL_EX                                              'SubmitResult'
         34        DO_FCALL                                      0  $26     
         35        ASSIGN                                                   !7, $26
   18    36        INIT_METHOD_CALL                                         !7, 'appendChild'
         37        INIT_METHOD_CALL                                         !4, 'createElement'
         38        SEND_VAL_EX                                              'MobileNo'
         39        CHECK_FUNC_ARG                                           
         40        FETCH_DIM_FUNC_ARG                               $28     !6, 'MobileNo'
         41        SEND_FUNC_ARG                                            $28
         42        DO_FCALL                                      0  $29     
         43        SEND_VAR_NO_REF_EX                                       $29
         44        DO_FCALL                                      0          
   19    45        INIT_METHOD_CALL                                         !7, 'appendChild'
         46        INIT_METHOD_CALL                                         !4, 'createElement'
         47        SEND_VAL_EX                                              'StatusId'
         48        SEND_VAL_EX                                              0
         49        DO_FCALL                                      0  $31     
         50        SEND_VAR_NO_REF_EX                                       $31
         51        DO_FCALL                                      0          
   20    52        INIT_METHOD_CALL                                         !7, 'appendChild'
         53        INIT_METHOD_CALL                                         !4, 'createElement'
         54        SEND_VAL_EX                                              'StatusText'
         55        SEND_VAL_EX                                              'Success%3A+Message+submitted+successfully'
         56        DO_FCALL                                      0  $33     
         57        SEND_VAR_NO_REF_EX                                       $33
         58        DO_FCALL                                      0          
   21    59        INIT_METHOD_CALL                                         !5, 'appendChild'
         60        SEND_VAR_EX                                              !7
         61        DO_FCALL                                      0          
   16    62      > JMP                                                      ->31
         63    >   FE_FREE                                                  $25
   24    64        INIT_METHOD_CALL                                         !4, 'saveXML'
         65        DO_FCALL                                      0          
   25    66        INIT_FCALL                                               'microtime'
         67        SEND_VAL                                                 <true>
         68        DO_ICALL                                         $37     
         69        ASSIGN                                                   !8, $37
   26    70        SUB                                              ~39     !8, !0
         71        ASSIGN                                                   !9, ~39
   27    72        CONCAT                                           ~41     'Start%3A+', !0
         73        CONCAT                                           ~42     ~41, '%0A'
         74        ECHO                                                     ~42
   28    75        CONCAT                                           ~43     'Stop%3A+', !8
         76        CONCAT                                           ~44     ~43, '%0A'
         77        ECHO                                                     ~44
   29    78        CONCAT                                           ~45     'Seconds%3A+', !9
         79        CONCAT                                           ~46     ~45, '%0A'
         80        ECHO                                                     ~46
   30    81        INIT_FCALL                                               'memory_get_peak_usage'
         82        DO_ICALL                                         $47     
         83        DIV                                              ~48     $47, 1048576
         84        CONCAT                                           ~49     'Memory+peak%3A+', ~48
         85        CONCAT                                           ~50     ~49, 'MB'
         86        CONCAT                                           ~51     ~50, '%0A'
         87        ECHO                                                     ~51
   31    88      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.48 ms | 949 KiB | 20 Q