Skip to main content
added 9 characters in body
Source Link
aross
  • 1.7k
  • 10
  • 12

PHP, 17 bytes

<?=1-join($argv);

Run like this:

echo '<?=1-join($argv);' | php -- 0 0
> 1

Explanation

This just concatenates the arguments. The first argument (script name) contains -. So that results in a negative number, which I negate with the minus sign. Then I add 1, just in case the first input number is a 0 (0123 = 123).

PHP, 17 bytes

<?=1-join($argv);

Run like this:

echo '<?=1-join($argv);' | php -- 0 0

Explanation

This just concatenates the arguments. The first argument (script name) contains -. So that results in a negative number, which I negate with the minus sign. Then I add 1, just in case the first input number is a 0 (0123 = 123).

PHP, 17 bytes

<?=1-join($argv);

Run like this:

echo '<?=1-join($argv);' | php -- 0 0
> 1

Explanation

This just concatenates the arguments. The first argument (script name) contains -. So that results in a negative number, which I negate with the minus sign. Then I add 1, just in case the first input number is a 0 (0123 = 123).

Source Link
aross
  • 1.7k
  • 10
  • 12

PHP, 17 bytes

<?=1-join($argv);

Run like this:

echo '<?=1-join($argv);' | php -- 0 0

Explanation

This just concatenates the arguments. The first argument (script name) contains -. So that results in a negative number, which I negate with the minus sign. Then I add 1, just in case the first input number is a 0 (0123 = 123).