3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrDates = array( "12/25/2009","01/10/2008","02/12/2000","03/17/1948", "03/06/1948","11/25/1972","10/23/2009","01/14/2008", "02/22/2000","03/27/1948","03/16/1948","11/24/1972", "11/13/2009","11/10/2008","12/12/2000","05/17/1948", "05/06/1948","10/25/1972","09/23/2009","02/14/2008", "03/22/2000","04/27/1948","04/16/1948","08/24/1972" ); /** * better_cmp() * @param int $a * @param int $b * date comparison callback **/ function better_cmp($a,$b){ list($a,$b) = [strtotime($a), strtotime($b)]; return ($a <=> $b); } usort($arrDates,"better_cmp"); print_r($arrDates);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d1Z57
function name:  (null)
number of ops:  9
compiled vars:  !0 = $arrDates
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   24     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'better_cmp'
          4        DO_ICALL                                                 
   25     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function better_cmp:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d1Z57
function name:  better_cmp
number of ops:  18
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   21     2        INIT_FCALL                                               'strtotime'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $2      
          5        INIT_ARRAY                                       ~3      $2
          6        INIT_FCALL                                               'strtotime'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $4      
          9        ADD_ARRAY_ELEMENT                                ~3      $4
         10        FETCH_LIST_R                                     $5      ~3, 0
         11        ASSIGN                                                   !0, $5
         12        FETCH_LIST_R                                     $7      ~3, 1
         13        ASSIGN                                                   !1, $7
         14        FREE                                                     ~3
   22    15        SPACESHIP                                        ~9      !0, !1
         16      > RETURN                                                   ~9
   23    17*     > RETURN                                                   null

End of function better_cmp

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.02 ms | 1395 KiB | 19 Q