3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Documented in the interface. function formatDuration($locale, $duration) { $rule = " %with-words: 0: 0 seconds; 1: 1 second; 2: =#0= seconds; 60/60: <%%min<; 61/60: <%%min<, >%with-words>; 3600/60: <%%hr<; 3601/60: <%%hr<, >%with-words>; 86400/86400: <%%day<; 86401/86400: <%%day<, >%with-words>; 604800/604800: <%%week<; 604801/604800: <%%week<, >%with-words>; %%min: 1: 1 minute; 2: =#0= minutes; %%hr: 1: 1 hour; 2: =#0= hours; %%day: 1: 1 day; 2: =#0= days; %%week: 1: 1 week; 2: =#0= weeks; "; $fmt = new NumberFormatter($locale, NumberFormatter::PATTERN_RULEBASED, $rule); return $fmt->format($duration); } formatDuration('en_US', 12345); formatDuration('fr_CA', 12345);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/51LZP
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   INIT_FCALL                                               'formatduration'
          1        SEND_VAL                                                 'en_US'
          2        SEND_VAL                                                 12345
          3        DO_FCALL                                      0          
   37     4        INIT_FCALL                                               'formatduration'
          5        SEND_VAL                                                 'fr_CA'
          6        SEND_VAL                                                 12345
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Function formatduration:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/51LZP
function name:  formatDuration
number of ops:  15
compiled vars:  !0 = $locale, !1 = $duration, !2 = $rule, !3 = $fmt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        ASSIGN                                                   !2, '%0A%25with-words%3A%0A++++0%3A+0+seconds%3B%0A++++1%3A+1+second%3B%0A++++2%3A+%3D%230%3D+seconds%3B%0A++++60%2F60%3A+%3C%25%25min%3C%3B%0A++++61%2F60%3A+%3C%25%25min%3C%2C+%3E%25with-words%3E%3B%0A++++3600%2F60%3A+%3C%25%25hr%3C%3B%0A++++3601%2F60%3A+%3C%25%25hr%3C%2C+%3E%25with-words%3E%3B%0A++++86400%2F86400%3A+%3C%25%25day%3C%3B%0A++++86401%2F86400%3A+%3C%25%25day%3C%2C+%3E%25with-words%3E%3B%0A++++604800%2F604800%3A+%3C%25%25week%3C%3B%0A++++604801%2F604800%3A+%3C%25%25week%3C%2C+%3E%25with-words%3E%3B%0A%25%25min%3A%0A++++1%3A+1+minute%3B%0A++++2%3A+%3D%230%3D+minutes%3B%0A%25%25hr%3A%0A++++1%3A+1+hour%3B%0A++++2%3A+%3D%230%3D+hours%3B%0A%25%25day%3A%0A++++1%3A+1+day%3B%0A++++2%3A+%3D%230%3D+days%3B%0A%25%25week%3A%0A++++1%3A+1+week%3B%0A++++2%3A+%3D%230%3D+weeks%3B%0A'
   32     3        NEW                                              $5      'NumberFormatter'
          4        SEND_VAR_EX                                              !0
          5        FETCH_CLASS_CONSTANT                             ~6      'NumberFormatter', 'PATTERN_RULEBASED'
          6        SEND_VAL_EX                                              ~6
          7        SEND_VAR_EX                                              !2
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !3, $5
   33    10        INIT_METHOD_CALL                                         !3, 'format'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0  $9      
         13      > RETURN                                                   $9
   34    14*     > RETURN                                                   null

End of function formatduration

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.11 ms | 1399 KiB | 15 Q