3v4l.org

run code in 300+ PHP versions simultaneously
<?php $users = [ [ 'name' => 'Tim', 'bday' => 'September 13', ], [ 'name' => 'Scott', 'bday' => 'November 3', ], [ 'name' => 'Bob', 'bday' => 'October 2', ], ]; $now = new DateTime(); usort($users, function($a, $b) use ($now) { $aDate = new DateTime($a['bday']); if ($aDate < $now) { $aDate->add(new DateInterval('P1Y')); } $bDate = new DateTime($b['bday']); if ($bDate < $now) { $bDate->add(new DateInterval('P1Y')); } return $aDate > $bDate; }); print_r($users);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/u3U80
function name:  (null)
number of ops:  14
compiled vars:  !0 = $users, !1 = $now
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   18     1        NEW                                              $3      'DateTime'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $3
   20     4        INIT_FCALL                                               'usort'
          5        SEND_REF                                                 !0
          6        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
          7        BIND_LEXICAL                                             ~6, !1
   32     8        SEND_VAL                                                 ~6
   20     9        DO_ICALL                                                 
   34    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
         13      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 31
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
Branch analysis from position: 17
filename:       /in/u3U80
function name:  {closure}
number of ops:  34
compiled vars:  !0 = $a, !1 = $b, !2 = $now, !3 = $aDate, !4 = $bDate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   21     3        NEW                                              $5      'DateTime'
          4        CHECK_FUNC_ARG                                           
          5        FETCH_DIM_FUNC_ARG                               $6      !0, 'bday'
          6        SEND_FUNC_ARG                                            $6
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !3, $5
   22     9        IS_SMALLER                                               !3, !2
         10      > JMPZ                                                     ~9, ->17
   23    11    >   INIT_METHOD_CALL                                         !3, 'add'
         12        NEW                                              $10     'DateInterval'
         13        SEND_VAL_EX                                              'P1Y'
         14        DO_FCALL                                      0          
         15        SEND_VAR_NO_REF_EX                                       $10
         16        DO_FCALL                                      0          
   26    17    >   NEW                                              $13     'DateTime'
         18        CHECK_FUNC_ARG                                           
         19        FETCH_DIM_FUNC_ARG                               $14     !1, 'bday'
         20        SEND_FUNC_ARG                                            $14
         21        DO_FCALL                                      0          
         22        ASSIGN                                                   !4, $13
   27    23        IS_SMALLER                                               !4, !2
         24      > JMPZ                                                     ~17, ->31
   28    25    >   INIT_METHOD_CALL                                         !4, 'add'
         26        NEW                                              $18     'DateInterval'
         27        SEND_VAL_EX                                              'P1Y'
         28        DO_FCALL                                      0          
         29        SEND_VAR_NO_REF_EX                                       $18
         30        DO_FCALL                                      0          
   31    31    >   IS_SMALLER                                       ~21     !4, !3
         32      > RETURN                                                   ~21
   32    33*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.62 ms | 1021 KiB | 15 Q