Garbage Collection in PHP – Amazing feature

Last few week i worked on data scrapping projects, million of pages need to scrap and later insertion into database. cron jobs were set to process these records and were running for many days. memory management become critical for that project. In PHP we have two most famous ways to free memory after job is […]

Check PHP Code Performance and stdClass using InfiniteIterator

Following code is written using stdClass and PHP iterator “InfiniteIterator” $start_time = microtime(true); $std = new stdClass(); $std->first = “first”; $std->second = “second”; $std->third = “third”; $iterator = new InfiniteIterator(new ArrayIterator($std)); foreach ( new LimitIterator($iterator, 0, 1400000) as $value ) { print($value . PHP_EOL); } $end_time = microtime(true); print $end_time – $start_time . ” Sec” . […]