3v4l.org

run code in 300+ PHP versions simultaneously
<?php function shouldUpdateUsername($source, $existing) { if ($source !== $existing) { $pattern = sprintf('/%s \[\d+\]/', preg_quote($source, '/')); $processedBefore = preg_match($pattern, $existing) !== 1; $sourceAvailable = false; return $sourceAvailable || $processedBefore; } return false; } var_dump(shouldUpdateUsername('Test 1', 'Test'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5JnMj
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'shouldupdateusername'
          2        SEND_VAL                                                 'Test+1'
          3        SEND_VAL                                                 'Test'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function shouldupdateusername:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 23
Branch analysis from position: 4
2 jumps found. (Code = 47) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5JnMj
function name:  shouldUpdateUsername
number of ops:  25
compiled vars:  !0 = $source, !1 = $existing, !2 = $pattern, !3 = $processedBefore, !4 = $sourceAvailable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        IS_NOT_IDENTICAL                                         !0, !1
          3      > JMPZ                                                     ~5, ->23
    7     4    >   INIT_FCALL                                               'sprintf'
          5        SEND_VAL                                                 '%2F%25s+%5C%5B%5Cd%2B%5C%5D%2F'
          6        INIT_FCALL                                               'preg_quote'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 '%2F'
          9        DO_ICALL                                         $6      
         10        SEND_VAR                                                 $6
         11        DO_ICALL                                         $7      
         12        ASSIGN                                                   !2, $7
    8    13        INIT_FCALL                                               'preg_match'
         14        SEND_VAR                                                 !2
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $9      
         17        IS_NOT_IDENTICAL                                 ~10     $9, 1
         18        ASSIGN                                                   !3, ~10
    9    19        ASSIGN                                                   !4, <false>
   10    20      > JMPNZ_EX                                         ~13     !4, ->22
         21    >   BOOL                                             ~13     !3
         22    > > RETURN                                                   ~13
   13    23    > > RETURN                                                   <false>
   14    24*     > RETURN                                                   null

End of function shouldupdateusername

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.33 ms | 1390 KiB | 22 Q