I'm having little trouble with this code that reads ordernumbers from txt file, then adds 1 to that number. However PHP does not add these numbers together regardless of automatic type-casting...
$handle1 = fopen("ordernumbers.txt", "r");
$numberoforders = fgets($handle1);
$numberoforders = trim($numberoforders);
$orderid=$numberoforders+1;
echo $orderid;
When echoing $numberoforders, it returns number 5 (type is string)
When echoing $orderid, it returns 1, while it should give 6.
I can not see any problem here, and it still does not work. I tried also to change that variable type from string to int, and then add these numbers together, but same result (1).
edit:here's the contents of the txt file: http://imgur.com/bzjOuOJ