Apologies if my question is redundant or irrelevant. I am a PHP developer and I need to upgrade a custom Magento module to support in higher versions of Magento. I have made themes and plugins in WordPress but I am at the very beginning stage of Magento modules development. Currently, the plugin works totally fine in Magento 1.8.x and initial versions of Magento 1.9.x. But in any Magento installation that uses PHP version higher than 5.6.19, the plugin gives error during installation. I couldn't find any step by step guide to do this. Also please tell me do I need to create the custom module from scratch for Magento 2.
Well, it's a good question and while not Magento specific per se, it's a problem extension developers often disregard. I personally try to avoid certain approaches that are either deprecated or too new. For example for Magento 1 I use array() even though newer PHP versions support shorter  syntax.
Read release notes, test, modify. Rinse and repeat.