Memory optimizations when creating cache file

The following changes help to reduce the memory peak usage by up to 60%, tested with PHP 5.5 and 5.6:

- unset all variables as soon as possible
- split loop into multiple parts and change their order to be able to unset unnecessary data between those parts
- replace foreach loops with for loops
- use SplFixedArray where possible
- do not save data in object properties, but in temporary files, to reduce memory peak while preparing cache data
Memory optimizations (for cached version)

Replaced serialize/unserialize with json_encode/json_decode to reduce cache file size and memory peak usage (for cached version).

Previous values:
Without cache: 41.461456298828M
With cache: 15.801124572754M

New values:
Without cache: 41.448585510254 (-0,03%)
With cache: 13.756393432617 (-12,94%)
Merge branch 'patch-3' of https://github.com/ziege/browscap-php into ziege-patch-3

Conflicts:
	src/phpbrowscap/Browscap.php
Merge branch 'ziege-patch-3' into 3.x
update from branch 3.x