3v4l.org

run code in 300+ PHP versions simultaneously
<?php function perfect_time($time) { return strtotime($time); } function zone2time($zone_offset) { return @preg_match("/^([\\+\\-]{1})?([0-9]{1,2}):([0-9]{1,2})$/i", preg_replace("/[a-z\\s]+/", null, strtolower($zone_offset)), $out) ? perfect_time("{$out[2]} Hours {$out[3]} Mins" . ($out[1] === "-" ? " ago" : null)) : false; } var_dump(zone2time(" GMT 05 : 30 "));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3JWoG
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'zone2time'
          2        SEND_VAL                                                 '+GMT+05+%3A+30+'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function perfect_time:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3JWoG
function name:  perfect_time
number of ops:  6
compiled vars:  !0 = $time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'strtotime'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
    6     5*     > RETURN                                                   null

End of function perfect_time

Function zone2time:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 35
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3JWoG
function name:  zone2time
number of ops:  38
compiled vars:  !0 = $zone_offset, !1 = $out
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
   10     1        BEGIN_SILENCE                                    ~2      
          2        INIT_FCALL                                               'preg_match'
          3        SEND_VAL                                                 '%2F%5E%28%5B%5C%2B%5C-%5D%7B1%7D%29%3F%28%5B0-9%5D%7B1%2C2%7D%29%3A%28%5B0-9%5D%7B1%2C2%7D%29%24%2Fi'
          4        INIT_FCALL                                               'preg_replace'
          5        SEND_VAL                                                 '%2F%5Ba-z%5Cs%5D%2B%2F'
          6        SEND_VAL                                                 null
          7        INIT_FCALL                                               'strtolower'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $3      
         10        SEND_VAR                                                 $3
         11        DO_ICALL                                         $4      
         12        SEND_VAR                                                 $4
         13        SEND_REF                                                 !1
         14        DO_ICALL                                         $5      
         15        END_SILENCE                                              ~2
         16      > JMPZ                                                     $5, ->35
   11    17    >   INIT_FCALL                                               'perfect_time'
         18        FETCH_DIM_R                                      ~6      !1, 2
         19        ROPE_INIT                                     4  ~9      ~6
         20        ROPE_ADD                                      1  ~9      ~9, '+Hours+'
         21        FETCH_DIM_R                                      ~7      !1, 3
         22        ROPE_ADD                                      2  ~9      ~9, ~7
         23        ROPE_END                                      3  ~8      ~9, '+Mins'
         24        FETCH_DIM_R                                      ~11     !1, 1
         25        IS_IDENTICAL                                             ~11, '-'
         26      > JMPZ                                                     ~12, ->29
         27    >   QM_ASSIGN                                        ~13     '+ago'
         28      > JMP                                                      ->30
         29    >   QM_ASSIGN                                        ~13     null
         30    >   CONCAT                                           ~14     ~8, ~13
         31        SEND_VAL                                                 ~14
         32        DO_FCALL                                      0  $15     
         33        QM_ASSIGN                                        ~16     $15
         34      > JMP                                                      ->36
         35    >   QM_ASSIGN                                        ~16     <false>
         36    > > RETURN                                                   ~16
   12    37*     > RETURN                                                   null

End of function zone2time

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.93 ms | 1394 KiB | 25 Q