3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = new DateTime("November 20th"); $dayOfWeek = $date->format("N"); if ($dayOfWeek > 1) { $date->modify($date->format("N") > 5 ? 'next monday' : 'previous monday'); } echo $date->format("Y-m-d");
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/t0mR8
function name:  (null)
number of ops:  26
compiled vars:  !0 = $date, !1 = $dayOfWeek
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $2      'DateTime'
          1        SEND_VAL_EX                                              'November+20th'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
    4     4        INIT_METHOD_CALL                                         !0, 'format'
          5        SEND_VAL_EX                                              'N'
          6        DO_FCALL                                      0  $5      
          7        ASSIGN                                                   !1, $5
    5     8        IS_SMALLER                                               1, !1
          9      > JMPZ                                                     ~7, ->21
    6    10    >   INIT_METHOD_CALL                                         !0, 'modify'
         11        INIT_METHOD_CALL                                         !0, 'format'
         12        SEND_VAL_EX                                              'N'
         13        DO_FCALL                                      0  $8      
         14        IS_SMALLER                                               5, $8
         15      > JMPZ                                                     ~9, ->18
         16    >   QM_ASSIGN                                        ~10     'next+monday'
         17      > JMP                                                      ->19
         18    >   QM_ASSIGN                                        ~10     'previous+monday'
         19    >   SEND_VAL_EX                                              ~10
         20        DO_FCALL                                      0          
    8    21    >   INIT_METHOD_CALL                                         !0, 'format'
         22        SEND_VAL_EX                                              'Y-m-d'
         23        DO_FCALL                                      0  $12     
         24        ECHO                                                     $12
         25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.21 ms | 1407 KiB | 13 Q