3v4l.org

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

Function iscasipalindromo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 7
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 7
Branch analysis from position: 18
Branch analysis from position: 7
Branch analysis from position: 14
filename:       /in/80UNs
function name:  IsCasiPalindromo
number of ops:  21
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                                                      ->16
    8     7    >   ECHO                                                     !2
    9     8        ECHO                                                     !3
   10     9        FETCH_DIM_R                                      ~9      !0, !2
         10        FETCH_DIM_R                                      ~10     !0, !3
         11        IS_NOT_EQUAL                                             ~9, ~10
         12      > JMPZ                                                     ~11, ->14
   11    13    >   PRE_INC                                                  !1
   13    14    >   PRE_INC                                                  !2
   14    15        PRE_DEC                                                  !3
    7    16    >   IS_SMALLER_OR_EQUAL                                      !2, !3
         17      > JMPNZ                                                    ~15, ->7
   16    18    >   IS_SMALLER_OR_EQUAL                              ~16     !1, 1
         19      > RETURN                                                   ~16
   17    20*     > RETURN                                                   null

End of function iscasipalindromo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.04 ms | 1403 KiB | 16 Q