3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getDay($day) { $days = ['Monday' => 1, 'Tuesday' => 2, 'Wednesday' => 3, 'Thursday' => 4, 'Friday' => 5, 'Saturday' => 6, 'Sunday' => 7]; $today = new \DateTime(); $today->setISODate((int)$today->format('o'), (int)$today->format('W'), $days[ucfirst($day)]); return $today; } var_dump(getDay('Monday')->format('l dS F Y')); var_dump(getDay('Friday')->format('l dS F Y'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ApLHk
function name:  (null)
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'getday'
          2        SEND_VAL                                                 'Monday'
          3        DO_FCALL                                      0  $0      
          4        INIT_METHOD_CALL                                         $0, 'format'
          5        SEND_VAL_EX                                              'l+dS+F+Y'
          6        DO_FCALL                                      0  $1      
          7        SEND_VAR                                                 $1
          8        DO_ICALL                                                 
   12     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'getday'
         11        SEND_VAL                                                 'Friday'
         12        DO_FCALL                                      0  $3      
         13        INIT_METHOD_CALL                                         $3, 'format'
         14        SEND_VAL_EX                                              'l+dS+F+Y'
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function getday:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ApLHk
function name:  getDay
number of ops:  25
compiled vars:  !0 = $day, !1 = $days, !2 = $today
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    6     2        NEW                                              $4      'DateTime'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !2, $4
    7     5        INIT_METHOD_CALL                                         !2, 'setISODate'
          6        INIT_METHOD_CALL                                         !2, 'format'
          7        SEND_VAL_EX                                              'o'
          8        DO_FCALL                                      0  $7      
          9        CAST                                          4  ~8      $7
         10        SEND_VAL_EX                                              ~8
         11        INIT_METHOD_CALL                                         !2, 'format'
         12        SEND_VAL_EX                                              'W'
         13        DO_FCALL                                      0  $9      
         14        CAST                                          4  ~10     $9
         15        SEND_VAL_EX                                              ~10
         16        CHECK_FUNC_ARG                                           
         17        INIT_FCALL                                               'ucfirst'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $11     
         20        FETCH_DIM_FUNC_ARG                               $12     !1, $11
         21        SEND_FUNC_ARG                                            $12
         22        DO_FCALL                                      0          
    8    23      > RETURN                                                   !2
    9    24*     > RETURN                                                   null

End of function getday

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.66 ms | 1468 KiB | 17 Q