3v4l.org

run code in 300+ PHP versions simultaneously
<?php //date in mm/dd/yyyy format; or it can be in other formats as well $birthDate = "12/17/1983"; //explode the date to get month, day and year $birthDate = explode("/", $birthDate); //get age from date or birthdate $age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md") ? ((date("Y") - $birthDate[2]) - 1) : (date("Y") - $birthDate[2])); echo "Age is:" . $age;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 38
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cgjCR
function name:  (null)
number of ops:  48
compiled vars:  !0 = $birthDate, !1 = $age
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '12%2F17%2F1983'
    5     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !0, $3
    7     6        INIT_FCALL                                               'date'
          7        SEND_VAL                                                 'md'
          8        INIT_FCALL                                               'date'
          9        SEND_VAL                                                 'U'
         10        INIT_FCALL                                               'mktime'
         11        SEND_VAL                                                 0
         12        SEND_VAL                                                 0
         13        SEND_VAL                                                 0
         14        FETCH_DIM_R                                      ~5      !0, 0
         15        SEND_VAL                                                 ~5
         16        FETCH_DIM_R                                      ~6      !0, 1
         17        SEND_VAL                                                 ~6
         18        FETCH_DIM_R                                      ~7      !0, 2
         19        SEND_VAL                                                 ~7
         20        DO_ICALL                                         $8      
         21        SEND_VAR                                                 $8
         22        DO_ICALL                                         $9      
         23        SEND_VAR                                                 $9
         24        DO_ICALL                                         $10     
         25        INIT_FCALL                                               'date'
         26        SEND_VAL                                                 'md'
         27        DO_ICALL                                         $11     
         28        IS_SMALLER                                               $11, $10
         29      > JMPZ                                                     ~12, ->38
    8    30    >   INIT_FCALL                                               'date'
         31        SEND_VAL                                                 'Y'
         32        DO_ICALL                                         $13     
         33        FETCH_DIM_R                                      ~14     !0, 2
         34        SUB                                              ~15     $13, ~14
         35        SUB                                              ~16     ~15, 1
         36        QM_ASSIGN                                        ~17     ~16
         37      > JMP                                                      ->44
    9    38    >   INIT_FCALL                                               'date'
         39        SEND_VAL                                                 'Y'
         40        DO_ICALL                                         $18     
         41        FETCH_DIM_R                                      ~19     !0, 2
         42        SUB                                              ~20     $18, ~19
         43        QM_ASSIGN                                        ~17     ~20
    7    44    >   ASSIGN                                                   !1, ~17
   10    45        CONCAT                                           ~22     'Age+is%3A', !1
         46        ECHO                                                     ~22
         47      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.11 ms | 1400 KiB | 19 Q