1 / 3
Aug 2011

<?php
$tot=fgets(STDIN);
$m=fgets(STDIN);
echo bcsub($tot,$m);
?>

inputs:
10
2
output
0

but this

<?php
$tot='10';
$m='2';
echo bcsub($tot,$m);
?>

gives proper output:
8

and in both cases, $tot and $m are strings,
why does this happen and how do i fix it?

  • created

    Aug '11
  • last reply

    Jan '15
  • 2

    replies

  • 615

    views

  • 2

    users

3 years later