3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Returns the day name according to the current locale * * @param int $n The day number (ISO-8601 numeric representation) * @param string $lc The desired locale for the returned day name * * @return string The day name */ function day_name(int $n, string $lc = "en_GB") { // Store the current locale so that we can reset it $olc = setlocale(LC_TIME, "0"); // Set the locale according to the $locale passed in setlocale(LC_TIME, $lc); // Get the day name according to the $locale passed in $output = strftime("%A", strtotime("Last Sunday +{$n} days")); // Reset the locale setLocale(LC_TIME, $olc); // Return the day name return $output; } echo day_name(4, "fr_FR");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pj1DH
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_FCALL                                               'day_name'
          1        SEND_VAL                                                 4
          2        SEND_VAL                                                 'fr_FR'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > RETURN                                                   1

Function day_name:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pj1DH
function name:  day_name
number of ops:  28
compiled vars:  !0 = $n, !1 = $lc, !2 = $olc, !3 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'en_GB'
   14     2        INIT_FCALL                                               'setlocale'
          3        SEND_VAL                                                 2
          4        SEND_VAL                                                 '0'
          5        DO_ICALL                                         $4      
          6        ASSIGN                                                   !2, $4
   17     7        INIT_FCALL                                               'setlocale'
          8        SEND_VAL                                                 2
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
   20    11        INIT_FCALL                                               'strftime'
         12        SEND_VAL                                                 '%25A'
         13        INIT_FCALL                                               'strtotime'
         14        ROPE_INIT                                     3  ~8      'Last+Sunday+%2B'
         15        ROPE_ADD                                      1  ~8      ~8, !0
         16        ROPE_END                                      2  ~7      ~8, '+days'
         17        SEND_VAL                                                 ~7
         18        DO_ICALL                                         $10     
         19        SEND_VAR                                                 $10
         20        DO_ICALL                                         $11     
         21        ASSIGN                                                   !3, $11
   23    22        INIT_FCALL                                               'setlocale'
         23        SEND_VAL                                                 2
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                                 
   26    26      > RETURN                                                   !3
   27    27*     > RETURN                                                   null

End of function day_name

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.58 ms | 1398 KiB | 20 Q