3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(array('date'=>'2014-12-01', 'price'=>'123.00'), array('date'=>'2013-12-01', 'price'=>'123.00'), array('date'=>'2014-02-01', 'price'=>'123.00'), array('date'=>'2014-03-01', 'price'=>'123.00')); var_dump($array); function date_compare($a, $b, $key) { $t1 = strtotime($a[$key]); $t2 = strtotime($b[$key]); return $t1 - $t2; } usort($array, array('date_compare', 'date')); var_dump($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZRXQS
function name:  (null)
number of ops:  12
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   12     4        INIT_FCALL                                               'usort'
          5        SEND_REF                                                 !0
          6        SEND_VAL                                                 <array>
          7        DO_ICALL                                                 
   14     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function date_compare:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZRXQS
function name:  date_compare
number of ops:  16
compiled vars:  !0 = $a, !1 = $b, !2 = $key, !3 = $t1, !4 = $t2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    8     3        INIT_FCALL                                               'strtotime'
          4        FETCH_DIM_R                                      ~5      !0, !2
          5        SEND_VAL                                                 ~5
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !3, $6
    9     8        INIT_FCALL                                               'strtotime'
          9        FETCH_DIM_R                                      ~8      !1, !2
         10        SEND_VAL                                                 ~8
         11        DO_ICALL                                         $9      
         12        ASSIGN                                                   !4, $9
   10    13        SUB                                              ~11     !3, !4
         14      > RETURN                                                   ~11
   11    15*     > RETURN                                                   null

End of function date_compare

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.68 ms | 1396 KiB | 19 Q