3v4l.org

run code in 300+ PHP versions simultaneously
<?php function IsCasiPalindromo($str){ $count = 0; $idx1 = 0; $idx2 = strlen($str)-1; while($idx1 <= $idx2){ if($str[$idx1] != $str[$idx2]){ $count++; } $idx1++; $idx2--; } return ($count<=1); } echo IsCasiPalindromo("abccba") . '<br>'; echo IsCasiPalindromo("abccbx") . '<br>'; echo IsCasiPalindromo("abccfg") . '<br>';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hfqib
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'iscasipalindromo'
          1        SEND_VAL                                                 'abccba'
          2        DO_FCALL                                      0  $0      
          3        CONCAT                                           ~1      $0, '%3Cbr%3E'
          4        ECHO                                                     ~1
   18     5        INIT_FCALL                                               'iscasipalindromo'
          6        SEND_VAL                                                 'abccbx'
          7        DO_FCALL                                      0  $2      
          8        CONCAT                                           ~3      $2, '%3Cbr%3E'
          9        ECHO                                                     ~3
   19    10        INIT_FCALL                                               'iscasipalindromo'
         11        SEND_VAL                                                 'abccfg'
         12        DO_FCALL                                      0  $4      
         13        CONCAT                                           ~5      $4, '%3Cbr%3E'
         14        ECHO                                                     ~5
         15      > RETURN                                                   1

Function iscasipalindromo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 7
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 7
Branch analysis from position: 16
Branch analysis from position: 7
Branch analysis from position: 12
filename:       /in/hfqib
function name:  IsCasiPalindromo
number of ops:  19
compiled vars:  !0 = $str, !1 = $count, !2 = $idx1, !3 = $idx2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, 0
    5     2        ASSIGN                                                   !2, 0
    6     3        STRLEN                                           ~6      !0
          4        SUB                                              ~7      ~6, 1
          5        ASSIGN                                                   !3, ~7
    7     6      > JMP                                                      ->14
    8     7    >   FETCH_DIM_R                                      ~9      !0, !2
          8        FETCH_DIM_R                                      ~10     !0, !3
          9        IS_NOT_EQUAL                                             ~9, ~10
         10      > JMPZ                                                     ~11, ->12
    9    11    >   PRE_INC                                                  !1
   11    12    >   PRE_INC                                                  !2
   12    13        PRE_DEC                                                  !3
    7    14    >   IS_SMALLER_OR_EQUAL                                      !2, !3
         15      > JMPNZ                                                    ~15, ->7
   14    16    >   IS_SMALLER_OR_EQUAL                              ~16     !1, 1
         17      > RETURN                                                   ~16
   15    18*     > RETURN                                                   null

End of function iscasipalindromo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
195.22 ms | 1457 KiB | 16 Q