3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = "racecar"; $pal = ""; for($a=0; $a<strlen($str); $a++) { for($z=0; $z<strlen($str); $z++) { $subs = substr($str, $a-1, $z); if( $subs == strrev($subs) and strlen($subs) > strlen($pal) ) { $pal = $subs; } } } echo $pal;
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 31
Branch analysis from position: 31
Jump found. Position 1 = 34, Position 2 = 4
Branch analysis from position: 34
Jump found. Position 1 = -2
Branch analysis from position: 4
Jump found. Position 1 = 26
Branch analysis from position: 26
Jump found. Position 1 = 29, Position 2 = 6
Branch analysis from position: 29
Jump found. Position 1 = 34, Position 2 = 4
Branch analysis from position: 34
Branch analysis from position: 4
Branch analysis from position: 6
Jump found. Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
Jump found. Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
Jump found. Position 1 = 29, Position 2 = 6
Branch analysis from position: 29
Branch analysis from position: 6
Branch analysis from position: 24
Branch analysis from position: 22
filename:       /in/hSN4b
function name:  (null)
number of ops:  36
compiled vars:  !0 = $str, !1 = $pal, !2 = $a, !3 = $z, !4 = $subs
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   ASSIGN                                                   !0, 'racecar'
   4     1        ASSIGN                                                   !1, ''
   6     2        ASSIGN                                                   !2, 0
         3      > JMP                                                      ->31
   8     4    >   ASSIGN                                                   !3, 0
         5      > JMP                                                      ->26
   9     6    >   INIT_FCALL                                               'substr'
         7        SEND_VAR                                                 !0
         8        SUB                                              ~9      !2, 1
         9        SEND_VAL                                                 ~9
        10        SEND_VAR                                                 !3
        11        DO_ICALL                                         $10     
        12        ASSIGN                                                   !4, $10
  10    13        INIT_FCALL                                               'strrev'
        14        SEND_VAR                                                 !4
        15        DO_ICALL                                         $12     
        16        IS_EQUAL                                         ~13     !4, $12
        17      > JMPZ_EX                                          ~13     ~13, ->22
        18    >   STRLEN                                           ~14     !4
        19        STRLEN                                           ~15     !1
        20        IS_SMALLER                                       ~16     ~15, ~14
        21        BOOL                                             ~13     ~16
        22    > > JMPZ                                                     ~13, ->24
  12    23    >   ASSIGN                                                   !1, !4
   8    24    >   POST_INC                                         ~18     !3
        25        FREE                                                     ~18
        26    >   STRLEN                                           ~19     !0
        27        IS_SMALLER                                       ~20     !3, ~19
        28      > JMPNZ                                                    ~20, ->6
   6    29    >   POST_INC                                         ~21     !2
        30        FREE                                                     ~21
        31    >   STRLEN                                           ~22     !0
        32        IS_SMALLER                                       ~23     !2, ~22
        33      > JMPNZ                                                    ~23, ->4
  18    34    >   ECHO                                                     !1
        35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.2.0