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')->getTimestamp()); var_dump(getDay('Friday'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ogJUh
function name:  (null)
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'getday'
          2        SEND_VAL                                                 'Monday'
          3        DO_FCALL                                      0  $0      
          4        INIT_METHOD_CALL                                         $0, 'getTimestamp'
          5        DO_FCALL                                      0  $1      
          6        SEND_VAR                                                 $1
          7        DO_ICALL                                                 
   13     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'getday'
         10        SEND_VAL                                                 'Friday'
         11        DO_FCALL                                      0  $3      
         12        SEND_VAR                                                 $3
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function getday:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ogJUh
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:
172.12 ms | 1399 KiB | 19 Q