3v4l.org

run code in 300+ PHP versions simultaneously
<?PHP if (!function_exists('str_split')) { function str_split($s) { $r = array(); for ($i=0;$i<=strlen($s);$i++) { $r[] = substr($s, $i, 1); } return $r; } } 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
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/HAmF0
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'function_exists'
          1        SEND_VAL                                                 'str_split'
          2        DO_ICALL                                         $0      
          3        BOOL_NOT                                         ~1      $0
          4      > JMPZ                                                     ~1, ->6
    4     5    >   DECLARE_FUNCTION                                         'str_split'
   44     6    >   INIT_FCALL                                               'inc_uuid'
          7        SEND_VAL                                                 'a2b9'
          8        DO_FCALL                                      0  $2      
          9        ECHO                                                     $2
   46    10      > RETURN                                                   1

Function %00str_split%2Fin%2FHAmF0%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 4
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 4
Branch analysis from position: 15
Branch analysis from position: 4
filename:       /in/HAmF0
function name:  str_split
number of ops:  17
compiled vars:  !0 = $s, !1 = $r, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, <array>
    6     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->12
    7     4    >   INIT_FCALL                                               'substr'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !2
          7        SEND_VAL                                                 1
          8        DO_ICALL                                         $6      
          9        ASSIGN_DIM                                               !1
         10        OP_DATA                                                  $6
    6    11        PRE_INC                                                  !2
         12    >   STRLEN                                           ~8      !0
         13        IS_SMALLER_OR_EQUAL                                      !2, ~8
         14      > JMPNZ                                                    ~9, ->4
    9    15    > > RETURN                                                   !1
   10    16*     > RETURN                                                   null

End of function %00str_split%2Fin%2FHAmF0%3A4%240

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/HAmF0
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
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
   13     1        ASSIGN                                                   !1, ''
   14     2        ASSIGN                                                   !2, 0
   15     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
   16    11    >   PRE_INC                                                  !2
   17    12        PRE_INC                                                  !3
   18    13        IS_IDENTICAL                                             !3, 'aa'
         14      > JMPZ                                                     ~12, ->19
   19    15    >   CONCAT                                           ~13     'a', !1
         16        ASSIGN                                                   !1, ~13
   20    17      > JMP                                                      ->10
         18*       JMP                                                      ->27
   22    19    >   IS_IDENTICAL                                             !3, 10
         20      > JMPZ                                                     ~15, ->24
   23    21    >   ASSIGN_OP                                     8          !1, 'a'
   24    22      > JMP                                                      ->10
         23*       JMP                                                      ->27
   27    24    >   CONCAT                                           ~17     !3, !1
         25        ASSIGN                                                   !1, ~17
   28    26      > JMP                                                      ->28
   15    27*       JMP                                                      ->10
         28    >   FE_FREE                                                  $9
   31    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
   32    44        CONCAT                                           ~26     !4, !1
         45        ASSIGN                                                   !1, ~26
   33    46      > RETURN                                                   !1
   34    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/HAmF0
function name:  get_uuid
number of ops:  10
compiled vars:  !0 = $__uuid
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   BIND_GLOBAL                                              !0, '__uuid'
   38     1        IS_EQUAL                                                 !0, null
          2      > JMPZ                                                     ~1, ->5
   39     3    > > RETURN                                                   '0a000000'
          4*       JMP                                                      ->9
   41     5    >   INIT_FCALL                                               'inc_uuid'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $2      
          8      > RETURN                                                   $2
   42     9*     > RETURN                                                   null

End of function get_uuid

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.07 ms | 1407 KiB | 27 Q