3v4l.org

run code in 300+ PHP versions simultaneously
<?PHP function inc_uuid($uuid) { $n = ''; $c = 0; foreach (str_split(strrev($uuid)) as $s) { $c++; $s++; if ($s === 'aa') { $n = 'a'.$n; continue; } elseif ($s === 10) { $n .= 'a'; continue; } else { $n = $s.$n; break; } } $x = implode(array_slice(str_split($uuid), 0, strlen($uuid-$c)+1)); $n = $x.$n; return $n; } function get_uuid() { global $__uuid; if ($__uuid == NULL) { return '0a000000'; } else return inc_uuid($__uuid); } echo inc_uuid('a2b9'); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tONDU
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   INIT_FCALL                                               'inc_uuid'
          1        SEND_VAL                                                 'a2b9'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
   37     4      > RETURN                                                   1

Function inc_uuid:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 28
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 28
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
Branch analysis from position: 28
filename:       /in/tONDU
function name:  inc_uuid
number of ops:  48
compiled vars:  !0 = $uuid, !1 = $n, !2 = $c, !3 = $s, !4 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, ''
    5     2        ASSIGN                                                   !2, 0
    6     3        INIT_FCALL                                               'str_split'
          4        INIT_FCALL                                               'strrev'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $7      
          7        SEND_VAR                                                 $7
          8        DO_ICALL                                         $8      
          9      > FE_RESET_R                                       $9      $8, ->28
         10    > > FE_FETCH_R                                               $9, !3, ->28
    7    11    >   PRE_INC                                                  !2
    8    12        PRE_INC                                                  !3
    9    13        IS_IDENTICAL                                             !3, 'aa'
         14      > JMPZ                                                     ~12, ->19
   10    15    >   CONCAT                                           ~13     'a', !1
         16        ASSIGN                                                   !1, ~13
   11    17      > JMP                                                      ->10
         18*       JMP                                                      ->27
   13    19    >   IS_IDENTICAL                                             !3, 10
         20      > JMPZ                                                     ~15, ->24
   14    21    >   ASSIGN_OP                                     8          !1, 'a'
   15    22      > JMP                                                      ->10
         23*       JMP                                                      ->27
   18    24    >   CONCAT                                           ~17     !3, !1
         25        ASSIGN                                                   !1, ~17
   19    26      > JMP                                                      ->28
    6    27*       JMP                                                      ->10
         28    >   FE_FREE                                                  $9
   22    29        INIT_FCALL                                               'implode'
         30        INIT_FCALL                                               'array_slice'
         31        INIT_FCALL                                               'str_split'
         32        SEND_VAR                                                 !0
         33        DO_ICALL                                         $19     
         34        SEND_VAR                                                 $19
         35        SEND_VAL                                                 0
         36        SUB                                              ~20     !0, !2
         37        STRLEN                                           ~21     ~20
         38        ADD                                              ~22     ~21, 1
         39        SEND_VAL                                                 ~22
         40        DO_ICALL                                         $23     
         41        SEND_VAR                                                 $23
         42        DO_ICALL                                         $24     
         43        ASSIGN                                                   !4, $24
   23    44        CONCAT                                           ~26     !4, !1
         45        ASSIGN                                                   !1, ~26
   24    46      > RETURN                                                   !1
   25    47*     > RETURN                                                   null

End of function inc_uuid

Function get_uuid:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tONDU
function name:  get_uuid
number of ops:  10
compiled vars:  !0 = $__uuid
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   BIND_GLOBAL                                              !0, '__uuid'
   29     1        IS_EQUAL                                                 !0, null
          2      > JMPZ                                                     ~1, ->5
   30     3    > > RETURN                                                   '0a000000'
          4*       JMP                                                      ->9
   32     5    >   INIT_FCALL                                               'inc_uuid'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $2      
          8      > RETURN                                                   $2
   33     9*     > RETURN                                                   null

End of function get_uuid

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.16 ms | 1403 KiB | 23 Q