3v4l.org

run code in 500+ PHP versions simultaneously
<?php $xml=simplexml_load_string(<<<XML <?xml version="1.0"?> <calender> <task> <date>00/00/0000</date> <title>My Birthday</title> <description>Today is my birthday!</description> </task> <task> <date>04/08/2013</date> <title>test</title> <description>swdefswde</description> </task> <task> <date>04/02/2013</date> <title>test</title> <description>test</description> </task> <task> <date>04/01/2013</date> <title>egfwe</title> <description>wefwef</description> </task> <task> <date>04/03/2013</date> <title>ssdv</title> <description>ssdvs</description> </task> </calender> XML ); $arr=array(); foreach($xml->task as $aTask) { $arr[]=$aTask; } //print_r($arr); usort($arr,function($a,$b){ return strtotime($a->date)-strtotime($b->date); }); //print_r($arr); $xml=simplexml_load_string(<<<XML <?xml version="1.0"?> <calender> </calender> XML ); foreach($arr as $aTask) { $tTask=$xml->addChild($aTask->getName()); $tTask->addChild($aTask->date->getName(),(string)$aTask->date); $tTask->addChild($aTask->title->getName(),(string)$aTask->title); $tTask->addChild($aTask->description->getName(),(string)$aTask->description); } echo $xml->asXML();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 57
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 57
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 57
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 57
Branch analysis from position: 11
filename:       /in/ODLNJ
function name:  (null)
number of ops:  62
compiled vars:  !0 = $xml, !1 = $arr, !2 = $aTask, !3 = $tTask
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                                   'simplexml_load_string'
    3     1        SEND_VAL                                                     '%3C%3Fxml+version%3D%221.0%22%3F%3E%0A%3Ccalender%3E%0A%0A%3Ctask%3E%0A%3Cdate%3E00%2F00%2F0000%3C%2Fdate%3E%0A%3Ctitle%3EMy+Birthday%3C%2Ftitle%3E%0A%3Cdescription%3EToday+is+my+birthday%21%3C%2Fdescription%3E%0A%3C%2Ftask%3E%0A%0A%3Ctask%3E%0A%3Cdate%3E04%2F08%2F2013%3C%2Fdate%3E%0A%3Ctitle%3Etest%3C%2Ftitle%3E%0A%3Cdescription%3Eswdefswde%3C%2Fdescription%3E%0A%3C%2Ftask%3E%0A%0A%3Ctask%3E%0A%3Cdate%3E04%2F02%2F2013%3C%2Fdate%3E%0A%3Ctitle%3Etest%3C%2Ftitle%3E%0A%3Cdescription%3Etest%3C%2Fdescription%3E%0A%3C%2Ftask%3E%0A%0A%3Ctask%3E%0A%3Cdate%3E04%2F01%2F2013%3C%2Fdate%3E%0A%3Ctitle%3Eegfwe%3C%2Ftitle%3E%0A%3Cdescription%3Ewefwef%3C%2Fdescription%3E%0A%3C%2Ftask%3E%0A%0A%3Ctask%3E%0A%3Cdate%3E04%2F03%2F2013%3C%2Fdate%3E%0A%3Ctitle%3Essdv%3C%2Ftitle%3E%0A%3Cdescription%3Essdvs%3C%2Fdescription%3E%0A%3C%2Ftask%3E%0A%0A%3C%2Fcalender%3E'
    2     2        DO_ICALL                                             $4      
          3        ASSIGN                                                       !0, $4
   39     4        ASSIGN                                                       !1, <array>
   40     5        FETCH_OBJ_R                                          ~7      !0, 'task'
          6      > FE_RESET_R                                           $8      ~7, ->11
          7    > > FE_FETCH_R                                                   $8, !2, ->11
   42     8    >   ASSIGN_DIM                                                   !1
          9        OP_DATA                                                      !2
   40    10      > JMP                                                          ->7
         11    >   FE_FREE                                                      $8
   45    12        INIT_FCALL                                                   'usort'
         13        SEND_REF                                                     !1
         14        DECLARE_LAMBDA_FUNCTION                              ~10     [0]
   47    15        SEND_VAL                                                     ~10
   45    16        DO_ICALL                                                     
   49    17        INIT_FCALL                                                   'simplexml_load_string'
   50    18        SEND_VAL                                                     '%3C%3Fxml+version%3D%221.0%22%3F%3E%0A%3Ccalender%3E%0A%3C%2Fcalender%3E'
   49    19        DO_ICALL                                             $12     
         20        ASSIGN                                                       !0, $12
   55    21      > FE_RESET_R                                           $14     !1, ->57
         22    > > FE_FETCH_R                                                   $14, !2, ->57
   57    23    >   INIT_METHOD_CALL                                             !0, 'addChild'
         24        INIT_METHOD_CALL                                             !2, 'getName'
         25        DO_FCALL                                          0  $15     
         26        SEND_VAR_NO_REF_EX                                           $15
         27        DO_FCALL                                          0  $16     
         28        ASSIGN                                                       !3, $16
   58    29        INIT_METHOD_CALL                                             !3, 'addChild'
         30        FETCH_OBJ_R                                          ~18     !2, 'date'
         31        INIT_METHOD_CALL                                             ~18, 'getName'
         32        DO_FCALL                                          0  $19     
         33        SEND_VAR_NO_REF_EX                                           $19
         34        FETCH_OBJ_R                                          ~20     !2, 'date'
         35        CAST                                              6  ~21     ~20
         36        SEND_VAL_EX                                                  ~21
         37        DO_FCALL                                          0          
   59    38        INIT_METHOD_CALL                                             !3, 'addChild'
         39        FETCH_OBJ_R                                          ~23     !2, 'title'
         40        INIT_METHOD_CALL                                             ~23, 'getName'
         41        DO_FCALL                                          0  $24     
         42        SEND_VAR_NO_REF_EX                                           $24
         43        FETCH_OBJ_R                                          ~25     !2, 'title'
         44        CAST                                              6  ~26     ~25
         45        SEND_VAL_EX                                                  ~26
         46        DO_FCALL                                          0          
   60    47        INIT_METHOD_CALL                                             !3, 'addChild'
         48        FETCH_OBJ_R                                          ~28     !2, 'description'
         49        INIT_METHOD_CALL                                             ~28, 'getName'
         50        DO_FCALL                                          0  $29     
         51        SEND_VAR_NO_REF_EX                                           $29
         52        FETCH_OBJ_R                                          ~30     !2, 'description'
         53        CAST                                              6  ~31     ~30
         54        SEND_VAL_EX                                                  ~31
         55        DO_FCALL                                          0          
   55    56      > JMP                                                          ->22
         57    >   FE_FREE                                                      $14
   62    58        INIT_METHOD_CALL                                             !0, 'asXML'
         59        DO_FCALL                                          0  $33     
         60        ECHO                                                         $33
         61      > 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/ODLNJ
function name:  {closure:/in/ODLNJ:45}
number of ops:  13
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   45     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   46     2        INIT_FCALL                                                   'strtotime'
          3        FETCH_OBJ_R                                          ~2      !0, 'date'
          4        SEND_VAL                                                     ~2
          5        DO_ICALL                                             $3      
          6        INIT_FCALL                                                   'strtotime'
          7        FETCH_OBJ_R                                          ~4      !1, 'date'
          8        SEND_VAL                                                     ~4
          9        DO_ICALL                                             $5      
         10        SUB                                                  ~6      $3, $5
         11      > RETURN                                                       ~6
   47    12*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
186.06 ms | 3540 KiB | 16 Q