3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ [ "id" => "3f57dc7c-a698-e911-a95e-000d3a454330", "date" => [ [ "start_date" => "23.11.2020 07:00", "end_date" => "04.12.2020 16:00" ], [ "start_date" => "02.03.2020 07:00", "end_date" => "13.03.2020 16:00" ], [ "start_date" => "06.01.2020 07:00", "end_date" => "14.02.2020 21:00" ], [ "start_date" => "20.01.2020 07:00", "end_date" => "28.02.2020 07:00" ], [ "start_date" => "23.03.2020 07:00", "end_date" => "03.04.2020 15:00" ], [ "start_date" => "31.08.2020 06:00", "end_date" => "09.10.2020 15:00" ], [ "start_date" => "12.10.2020 06:00", "end_date" => "23.10.2020 15:00" ] ] ] ]; foreach ($data as $entry) { $tmp[] = usort($entry['date'], function($a, $b) { $a = DateTime::createFromFormat('d.m.Y H:i', $a['start_date']); $b = DateTime::createFromFormat('d.m.Y H:i', $b['start_date']); /* if ($a == $b) { return 0; } return $a < $b ? -1 : 1;*/ return $a <=> $b; }); } var_dump($data[0]['date']);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 12
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/39k53
function name:  (null)
number of ops:  19
compiled vars:  !0 = $data, !1 = $entry, !2 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   39     1      > FE_RESET_R                                       $4      !0, ->12
          2    > > FE_FETCH_R                                               $4, !1, ->12
   40     3    >   INIT_FCALL                                               'usort'
          4        FETCH_DIM_W                                      $6      !1, 'date'
          5        SEND_REF                                                 $6
          6        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
   49     7        SEND_VAL                                                 ~7
   40     8        DO_ICALL                                         $8      
          9        ASSIGN_DIM                                               !2
   49    10        OP_DATA                                                  $8
   39    11      > JMP                                                      ->2
         12    >   FE_FREE                                                  $4
   51    13        INIT_FCALL                                               'var_dump'
         14        FETCH_DIM_R                                      ~9      !0, 0
         15        FETCH_DIM_R                                      ~10     ~9, 'date'
         16        SEND_VAL                                                 ~10
         17        DO_ICALL                                                 
         18      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/39k53
function name:  {closure}
number of ops:  17
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   41     2        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          3        SEND_VAL                                                 'd.m.Y+H%3Ai'
          4        FETCH_DIM_R                                      ~2      !0, 'start_date'
          5        SEND_VAL                                                 ~2
          6        DO_FCALL                                      0  $3      
          7        ASSIGN                                                   !0, $3
   42     8        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          9        SEND_VAL                                                 'd.m.Y+H%3Ai'
         10        FETCH_DIM_R                                      ~5      !1, 'start_date'
         11        SEND_VAL                                                 ~5
         12        DO_FCALL                                      0  $6      
         13        ASSIGN                                                   !1, $6
   48    14        SPACESHIP                                        ~8      !0, !1
         15      > RETURN                                                   ~8
   49    16*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.23 ms | 1016 KiB | 15 Q