3v4l.org

run code in 300+ PHP versions simultaneously
<?php $result = array( array('starName' => 'Amber Dawn Fox', 'posted' => 'Tue, 5 Jan 2016 5:54(48)'), array('starName' => 'Peyton Kennedy', 'posted' => 'Wed, 6 Feb 2016 6:25(34)'), ); function compareByDate($item1, $item2) { $a = DateTime::createFromFormat('D, j M Y G:i(s)', $item1['posted']); $b = DateTime::createFromFormat('D, j M Y G:i(s)', $item2['posted']); return $b->getTimeStamp() - $a->getTimeStamp(); } usort($result, 'compareByDate'); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jFe88
function name:  (null)
number of ops:  9
compiled vars:  !0 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'compareByDate'
          4        DO_ICALL                                                 
   15     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function comparebydate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jFe88
function name:  compareByDate
number of ops:  21
compiled vars:  !0 = $item1, !1 = $item2, !2 = $a, !3 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          3        SEND_VAL                                                 'D%2C+j+M+Y+G%3Ai%28s%29'
          4        FETCH_DIM_R                                      ~4      !0, 'posted'
          5        SEND_VAL                                                 ~4
          6        DO_FCALL                                      0  $5      
          7        ASSIGN                                                   !2, $5
   10     8        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          9        SEND_VAL                                                 'D%2C+j+M+Y+G%3Ai%28s%29'
         10        FETCH_DIM_R                                      ~7      !1, 'posted'
         11        SEND_VAL                                                 ~7
         12        DO_FCALL                                      0  $8      
         13        ASSIGN                                                   !3, $8
   11    14        INIT_METHOD_CALL                                         !3, 'getTimeStamp'
         15        DO_FCALL                                      0  $10     
         16        INIT_METHOD_CALL                                         !2, 'getTimeStamp'
         17        DO_FCALL                                      0  $11     
         18        SUB                                              ~12     $10, $11
         19      > RETURN                                                   ~12
   12    20*     > RETURN                                                   null

End of function comparebydate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.55 ms | 1007 KiB | 15 Q