3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "Fasd-2"; $sub=substr($string, strrpos($string, "-")+1, strlen($string) - strrpos($string, "-")); if (is_numeric($sub)) { echo substr($string, 0, strlen($string) - strlen($sub)) . "\n"; $newString = substr($string, 0, strlen($string) - strlen($sub)) . " - " . (int)$sub+1; } else { $newString = $string . "-1"; } echo $newString;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 46
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fUd8J
function name:  (null)
number of ops:  50
compiled vars:  !0 = $string, !1 = $sub, !2 = $newString
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Fasd-2'
    5     1        INIT_FCALL                                               'substr'
          2        SEND_VAR                                                 !0
          3        INIT_FCALL                                               'strrpos'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 '-'
          6        DO_ICALL                                         $4      
          7        ADD                                              ~5      $4, 1
          8        SEND_VAL                                                 ~5
          9        STRLEN                                           ~6      !0
         10        INIT_FCALL                                               'strrpos'
         11        SEND_VAR                                                 !0
         12        SEND_VAL                                                 '-'
         13        DO_ICALL                                         $7      
         14        SUB                                              ~8      ~6, $7
         15        SEND_VAL                                                 ~8
         16        DO_ICALL                                         $9      
         17        ASSIGN                                                   !1, $9
    6    18        INIT_FCALL                                               'is_numeric'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $11     
         21      > JMPZ                                                     $11, ->46
    7    22    >   INIT_FCALL                                               'substr'
         23        SEND_VAR                                                 !0
         24        SEND_VAL                                                 0
         25        STRLEN                                           ~12     !0
         26        STRLEN                                           ~13     !1
         27        SUB                                              ~14     ~12, ~13
         28        SEND_VAL                                                 ~14
         29        DO_ICALL                                         $15     
         30        CONCAT                                           ~16     $15, '%0A'
         31        ECHO                                                     ~16
    8    32        INIT_FCALL                                               'substr'
         33        SEND_VAR                                                 !0
         34        SEND_VAL                                                 0
         35        STRLEN                                           ~17     !0
         36        STRLEN                                           ~18     !1
         37        SUB                                              ~19     ~17, ~18
         38        SEND_VAL                                                 ~19
         39        DO_ICALL                                         $20     
         40        CONCAT                                           ~21     $20, '+-+'
         41        CAST                                          4  ~22     !1
         42        ADD                                              ~23     ~22, 1
         43        CONCAT                                           ~24     ~21, ~23
         44        ASSIGN                                                   !2, ~24
         45      > JMP                                                      ->48
   10    46    >   CONCAT                                           ~26     !0, '-1'
         47        ASSIGN                                                   !2, ~26
   13    48    >   ECHO                                                     !2
         49      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.61 ms | 1392 KiB | 19 Q