3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calculate_birth_year($age, $day_month_string) { $now = new DateTime("now", new DateTimeZone('America/New_York')); if (preg_match('#^([0-9]+) ([a-z]+)$#', $day_month_string)) { $dt = new DateTime($day_month_string, new DateTimeZone('America/New_York')); if ($dt > $now) { ++$age; } return $dt->modify("$age years ago")->format('Y'); } else return false; } echo calculate_birth_year('34', '7 dec');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Im98q
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'calculate_birth_year'
          1        SEND_VAL                                                 '34'
          2        SEND_VAL                                                 '7+dec'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > RETURN                                                   1

Function calculate_birth_year:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 36
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 26
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Im98q
function name:  calculate_birth_year
number of ops:  38
compiled vars:  !0 = $age, !1 = $day_month_string, !2 = $now, !3 = $dt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        NEW                                              $4      'DateTime'
          3        SEND_VAL_EX                                              'now'
          4        NEW                                              $5      'DateTimeZone'
          5        SEND_VAL_EX                                              'America%2FNew_York'
          6        DO_FCALL                                      0          
          7        SEND_VAR_NO_REF_EX                                       $5
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !2, $4
    6    10        INIT_FCALL                                               'preg_match'
         11        SEND_VAL                                                 '%23%5E%28%5B0-9%5D%2B%29+%28%5Ba-z%5D%2B%29%24%23'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $9      
         14      > JMPZ                                                     $9, ->36
    8    15    >   NEW                                              $10     'DateTime'
         16        SEND_VAR_EX                                              !1
         17        NEW                                              $11     'DateTimeZone'
         18        SEND_VAL_EX                                              'America%2FNew_York'
         19        DO_FCALL                                      0          
         20        SEND_VAR_NO_REF_EX                                       $11
         21        DO_FCALL                                      0          
         22        ASSIGN                                                   !3, $10
    9    23        IS_SMALLER                                               !2, !3
         24      > JMPZ                                                     ~15, ->26
   10    25    >   PRE_INC                                                  !0
   12    26    >   INIT_METHOD_CALL                                         !3, 'modify'
         27        NOP                                                      
         28        FAST_CONCAT                                      ~17     !0, '+years+ago'
         29        SEND_VAL_EX                                              ~17
         30        DO_FCALL                                      0  $18     
         31        INIT_METHOD_CALL                                         $18, 'format'
         32        SEND_VAL_EX                                              'Y'
         33        DO_FCALL                                      0  $19     
         34      > RETURN                                                   $19
         35*       JMP                                                      ->37
   15    36    > > RETURN                                                   <false>
   16    37*     > RETURN                                                   null

End of function calculate_birth_year

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.59 ms | 1403 KiB | 16 Q