3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getFirstWeekOfYear(\DateTime $date = null) { if(!$date){ $date = new \DateTime(); } return (new \DateTime())->setISODate((int)$date->format('o') + 1, 1, $date->format('w')); } echo getFirstWeekOfYear(new \DateTime('2017-03-18'))->format('Y-m-d');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eFins
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'getfirstweekofyear'
          1        NEW                                              $0      'DateTime'
          2        SEND_VAL_EX                                              '2017-03-18'
          3        DO_FCALL                                      0          
          4        SEND_VAR                                                 $0
          5        DO_FCALL                                      0  $2      
          6        INIT_METHOD_CALL                                         $2, 'format'
          7        SEND_VAL_EX                                              'Y-m-d'
          8        DO_FCALL                                      0  $3      
          9        ECHO                                                     $3
         10      > RETURN                                                   1

Function getfirstweekofyear:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/eFins
function name:  getFirstWeekOfYear
number of ops:  23
compiled vars:  !0 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV_INIT                                        !0      null
    4     1        BOOL_NOT                                         ~1      !0
          2      > JMPZ                                                     ~1, ->6
    5     3    >   NEW                                              $2      'DateTime'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
    7     6    >   NEW                                              $5      'DateTime'
          7        DO_FCALL                                      0          
          8        INIT_METHOD_CALL                                         $5, 'setISODate'
          9        INIT_METHOD_CALL                                         !0, 'format'
         10        SEND_VAL_EX                                              'o'
         11        DO_FCALL                                      0  $7      
         12        CAST                                          4  ~8      $7
         13        ADD                                              ~9      ~8, 1
         14        SEND_VAL_EX                                              ~9
         15        SEND_VAL_EX                                              1
         16        INIT_METHOD_CALL                                         !0, 'format'
         17        SEND_VAL_EX                                              'w'
         18        DO_FCALL                                      0  $10     
         19        SEND_VAR_NO_REF_EX                                       $10
         20        DO_FCALL                                      0  $11     
         21      > RETURN                                                   $11
    8    22*     > RETURN                                                   null

End of function getfirstweekofyear

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.36 ms | 1399 KiB | 14 Q