3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr_dates = array(20150616,20150615,20150612,20150611,20150610,20150609,20150608,20150605,20150604,20150603,20150602,20150601,20150529,20150528,20150521,20150514,20150507,20150430,20150423,20150416,20150409,20150402,20150326); $current_date = 20150616; $expected_trend_date = 20150516; $expected_result = 20150514; $trend_dates = usort($arr_dates, function ($date1, $date2) use ($expected_trend_date) { return ($expected_trend_date - $date1) < ($expected_trend_date - $date2); }); var_dump($trend_dates);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JIaqZ
function name:  (null)
number of ops:  15
compiled vars:  !0 = $arr_dates, !1 = $current_date, !2 = $expected_trend_date, !3 = $expected_result, !4 = $trend_dates
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, 20150616
    6     2        ASSIGN                                                   !2, 20150516
    7     3        ASSIGN                                                   !3, 20150514
    9     4        INIT_FCALL                                               'usort'
          5        SEND_REF                                                 !0
          6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FJIaqZ%3A9%240'
          7        BIND_LEXICAL                                             ~9, !2
   11     8        SEND_VAL                                                 ~9
          9        DO_ICALL                                         $10     
    9    10        ASSIGN                                                   !4, $10
   13    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !4
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FJIaqZ%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JIaqZ
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $date1, !1 = $date2, !2 = $expected_trend_date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   10     3        SUB                                              ~3      !2, !0
          4        SUB                                              ~4      !2, !1
          5        IS_SMALLER                                       ~5      ~3, ~4
          6      > RETURN                                                   ~5
   11     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FJIaqZ%3A9%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.26 ms | 1399 KiB | 18 Q