Skip to main content
Commonmark migration
Source Link

#PHP, 95 74 64 bytes

PHP, 95 74 64 bytes

<?for($n=_;;print strrev($n))for($i=0;!$n[$i]=($n[++$i]+1)%10;);

or

<?for($n=_;;print strrev($n))while($i*=!$n[$i]=($n[++$i]+1)%10);

http://php.net/bc_installation: These functions are only available if PHP was configured with --enable-bcmath.
http://php.net/gmp_installation: In order to have these functions available, PHP must be compiled with GMP support by using the --with-gmp option.

So I just implemented bcadd ... sort of. Uses underscore as separator.

#PHP, 95 74 64 bytes

<?for($n=_;;print strrev($n))for($i=0;!$n[$i]=($n[++$i]+1)%10;);

or

<?for($n=_;;print strrev($n))while($i*=!$n[$i]=($n[++$i]+1)%10);

http://php.net/bc_installation: These functions are only available if PHP was configured with --enable-bcmath.
http://php.net/gmp_installation: In order to have these functions available, PHP must be compiled with GMP support by using the --with-gmp option.

So I just implemented bcadd ... sort of. Uses underscore as separator.

PHP, 95 74 64 bytes

<?for($n=_;;print strrev($n))for($i=0;!$n[$i]=($n[++$i]+1)%10;);

or

<?for($n=_;;print strrev($n))while($i*=!$n[$i]=($n[++$i]+1)%10);

http://php.net/bc_installation: These functions are only available if PHP was configured with --enable-bcmath.
http://php.net/gmp_installation: In order to have these functions available, PHP must be compiled with GMP support by using the --with-gmp option.

So I just implemented bcadd ... sort of. Uses underscore as separator.

added variant
Source Link
Titus
  • 14.8k
  • 1
  • 24
  • 41

#PHP, 95 74 64 bytes

<?for($n=_;;print strrev($n))for($i=0;!$n[$i]=($n[++$i]+1)%10;);

or

<?for($n=_;;print strrev($n))while($i*=!$n[$i]=($n[++$i]+1)%10);

http://php.net/bc_installation: These functions are only available if PHP was configured with --enable-bcmath.
http://php.net/gmp_installation: In order to have these functions available, PHP must be compiled with GMP support by using the --with-gmp option.

So I just implemented bcadd ... sort of. Uses underscore as separator.

#PHP, 95 74 64 bytes

<?for($n=_;;print strrev($n))for($i=0;!$n[$i]=($n[++$i]+1)%10;);

http://php.net/bc_installation: These functions are only available if PHP was configured with --enable-bcmath.
http://php.net/gmp_installation: In order to have these functions available, PHP must be compiled with GMP support by using the --with-gmp option.

So I just implemented bcadd ... sort of. Uses underscore as separator.

#PHP, 95 74 64 bytes

<?for($n=_;;print strrev($n))for($i=0;!$n[$i]=($n[++$i]+1)%10;);

or

<?for($n=_;;print strrev($n))while($i*=!$n[$i]=($n[++$i]+1)%10);

http://php.net/bc_installation: These functions are only available if PHP was configured with --enable-bcmath.
http://php.net/gmp_installation: In order to have these functions available, PHP must be compiled with GMP support by using the --with-gmp option.

So I just implemented bcadd ... sort of. Uses underscore as separator.

moved increment from loop pre-condition to calculation (-2), moved calculation from body to pre-condition (-8)
Source Link
Titus
  • 14.8k
  • 1
  • 24
  • 41

#PHP, 95 7474 64 bytes

<?for($n=_;;print strrev($n))for($i=0;++$i;)if($i=0;!$n[$i]=($n[$i]+1$n[++$i]+1)%10%10;)break;;

http://php.net/bc_installation: These functions are only available if PHP was configured with --enable-bcmath.
http://php.net/gmp_installation: In order to have these functions available, PHP must be compiled with GMP support by using the --with-gmp option.

So I just implemented bcadd ... sort of. Uses underscore as separator.

#PHP, 95 74 bytes

<?for($n=_;;print strrev($n))for($i=0;++$i;)if($n[$i]=($n[$i]+1)%10)break;

http://php.net/bc_installation: These functions are only available if PHP was configured with --enable-bcmath.
http://php.net/gmp_installation: In order to have these functions available, PHP must be compiled with GMP support by using the --with-gmp option.

So I just implemented bcadd ... sort of. Uses underscore as separator.

#PHP, 95 74 64 bytes

<?for($n=_;;print strrev($n))for($i=0;!$n[$i]=($n[++$i]+1)%10;);

http://php.net/bc_installation: These functions are only available if PHP was configured with --enable-bcmath.
http://php.net/gmp_installation: In order to have these functions available, PHP must be compiled with GMP support by using the --with-gmp option.

So I just implemented bcadd ... sort of. Uses underscore as separator.

replaced recursive function with a loop + further golfing (-21)
Source Link
Titus
  • 14.8k
  • 1
  • 24
  • 41
Loading
Source Link
Titus
  • 14.8k
  • 1
  • 24
  • 41
Loading