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 sortByDate($a, $b) { return $a['date'] - $b['date']; } usort($array, 'sortByDate'); var_dump($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aS3mP
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                                                 
   10     4        INIT_FCALL                                               'usort'
          5        SEND_REF                                                 !0
          6        SEND_VAL                                                 'sortByDate'
          7        DO_ICALL                                                 
   11     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function sortbydate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aS3mP
function name:  sortByDate
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        FETCH_DIM_R                                      ~2      !0, 'date'
          3        FETCH_DIM_R                                      ~3      !1, 'date'
          4        SUB                                              ~4      ~2, ~3
          5      > RETURN                                                   ~4
    8     6*     > RETURN                                                   null

End of function sortbydate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.14 ms | 1395 KiB | 17 Q