Skip to main content
-2 bytes thanks to @Night2!
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61

Not Python PHP, 85 8383 81 bytes

while($argn[$x])$y=$s==strrev$s!=strrev($s=substr_replace($argn,'',$x++,1))?$x:$y;echo$y?:die("$x");echo-1; 
  • -2 bytes thanks to @Night2!

Try it online!Try it online!

Unnecessarily recursive:

PHP, 96 bytes

function f($a,$b='',$d=1){return$a?$c==strrev($c=$b.$e=substr($a,1))?$d:f($e,$b.$a[0],$d+1):-1;} 

Try it online!

Not Python PHP, 85 83 bytes

while($argn[$x])$y=$s==strrev($s=substr_replace($argn,'',$x++,1))?$x:$y;echo$y?:-1; 

Try it online!

Unnecessarily recursive:

PHP, 96 bytes

function f($a,$b='',$d=1){return$a?$c==strrev($c=$b.$e=substr($a,1))?$d:f($e,$b.$a[0],$d+1):-1;} 

Try it online!

Not Python PHP, 85 83 81 bytes

while($argn[$x])$s!=strrev($s=substr_replace($argn,'',$x++,1))?:die("$x");echo-1; 
  • -2 bytes thanks to @Night2!

Try it online!

Unnecessarily recursive:

PHP, 96 bytes

function f($a,$b='',$d=1){return$a?$c==strrev($c=$b.$e=substr($a,1))?$d:f($e,$b.$a[0],$d+1):-1;} 

Try it online!

Rollback to Revision 3
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61

Not Python PHP, 85 83 bytes

while($argn[$x])$y=$s==strrev($s=substr_replace($argn,'',$x++,1))?$x:$y;echo$y?:-1; 

Try it online!

Unnecessarily recursive:

PHP, 96 bytes

function f($a,$b='',$d=1){return$a?$c==strrev($c=$b.$e=substr($a,1))?$d:f($e,$b.$a[0],$d+1):-1;} 

Try it online!

Not Python PHP, 85 83 bytes

while($argn[$x])$y=$s==strrev($s=substr_replace($argn,'',$x++,1))?$x:$y;echo$y?:-1; 

Try it online!

Not Python PHP, 85 83 bytes

while($argn[$x])$y=$s==strrev($s=substr_replace($argn,'',$x++,1))?$x:$y;echo$y?:-1; 

Try it online!

Unnecessarily recursive:

PHP, 96 bytes

function f($a,$b='',$d=1){return$a?$c==strrev($c=$b.$e=substr($a,1))?$d:f($e,$b.$a[0],$d+1):-1;} 

Try it online!

Rollback to Revision 2
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61

Not Python PHP, 85 83 bytes

while($argn[$x])$y=$s==strrev($s=substr_replace($argn,'',$x++,1))?$x:$y;echo$y?:-1; 

Try it online!

Unnecessarily recursive:

PHP, 96 bytes

function f($a,$b='',$d=1){return$a?$c==strrev($c=$b.$e=substr($a,1))?$d:f($e,$b.$a[0],$d+1):-1;} 

Try it online!

Not Python PHP, 85 83 bytes

while($argn[$x])$y=$s==strrev($s=substr_replace($argn,'',$x++,1))?$x:$y;echo$y?:-1; 

Try it online!

Unnecessarily recursive:

PHP, 96 bytes

function f($a,$b='',$d=1){return$a?$c==strrev($c=$b.$e=substr($a,1))?$d:f($e,$b.$a[0],$d+1):-1;} 

Try it online!

Not Python PHP, 85 83 bytes

while($argn[$x])$y=$s==strrev($s=substr_replace($argn,'',$x++,1))?$x:$y;echo$y?:-1; 

Try it online!

added 644 characters in body
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61
Loading
-2 bytes, just shorter to use $argn twice
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61
Loading
Source Link
640KB
  • 12.4k
  • 2
  • 38
  • 61
Loading