3v4l.org

run code in 300+ PHP versions simultaneously
<?php $newsArray = array(); $item_title = 'Hello World'; $media = 'Prothom Alo'; $pubDate = 'Sun, 18 Mar 2018 05:51:28 GMT'; //echo (new DateTime('Sun, 18 Mar 2018 05:51:28 GMT'))->format('l, d F Y'); $newsArray[0] = array( 'title' => (string)$item_title, 'media' => (string)$media, 'pubdate' => new DateTime($pubDate) ); $item_title = 'Hello World 2'; $media = 'Prothom Alo 2'; $pubDate = 'Sun, 19 Mar 2018 05:51:28 GMT'; $newsArray[1] = array( 'title' => (string)$item_title, 'media' => (string)$media, 'pubdate' => new DateTime($pubDate) ); usort($newsArray,'date_compare'); function date_compare($a, $b) { $t1 = $a['pubdate']; $t2 = $b['pubdate']; return $t1 - $t2; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iTfGp
function name:  (null)
number of ops:  32
compiled vars:  !0 = $newsArray, !1 = $item_title, !2 = $media, !3 = $pubDate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, 'Hello+World'
    5     2        ASSIGN                                                   !2, 'Prothom+Alo'
    6     3        ASSIGN                                                   !3, 'Sun%2C+18+Mar+2018+05%3A51%3A28+GMT'
   10     4        CAST                                          6  ~9      !1
          5        INIT_ARRAY                                       ~10     ~9, 'title'
   11     6        CAST                                          6  ~11     !2
          7        ADD_ARRAY_ELEMENT                                ~10     ~11, 'media'
   12     8        NEW                                              $12     'DateTime'
          9        SEND_VAR_EX                                              !3
         10        DO_FCALL                                      0          
         11        ADD_ARRAY_ELEMENT                                ~10     $12, 'pubdate'
    9    12        ASSIGN_DIM                                               !0, 0
   12    13        OP_DATA                                                  ~10
   15    14        ASSIGN                                                   !1, 'Hello+World+2'
   16    15        ASSIGN                                                   !2, 'Prothom+Alo+2'
   17    16        ASSIGN                                                   !3, 'Sun%2C+19+Mar+2018+05%3A51%3A28+GMT'
   19    17        CAST                                          6  ~18     !1
         18        INIT_ARRAY                                       ~19     ~18, 'title'
   20    19        CAST                                          6  ~20     !2
         20        ADD_ARRAY_ELEMENT                                ~19     ~20, 'media'
   21    21        NEW                                              $21     'DateTime'
         22        SEND_VAR_EX                                              !3
         23        DO_FCALL                                      0          
         24        ADD_ARRAY_ELEMENT                                ~19     $21, 'pubdate'
   18    25        ASSIGN_DIM                                               !0, 1
   21    26        OP_DATA                                                  ~19
   24    27        INIT_FCALL                                               'usort'
         28        SEND_REF                                                 !0
         29        SEND_VAL                                                 'date_compare'
         30        DO_ICALL                                                 
   33    31      > RETURN                                                   1

Function date_compare:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iTfGp
function name:  date_compare
number of ops:  9
compiled vars:  !0 = $a, !1 = $b, !2 = $t1, !3 = $t2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   28     2        FETCH_DIM_R                                      ~4      !0, 'pubdate'
          3        ASSIGN                                                   !2, ~4
   29     4        FETCH_DIM_R                                      ~6      !1, 'pubdate'
          5        ASSIGN                                                   !3, ~6
   30     6        SUB                                              ~8      !2, !3
          7      > RETURN                                                   ~8
   31     8*     > RETURN                                                   null

End of function date_compare

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.59 ms | 1400 KiB | 15 Q