Coding languages like all software has versions. These versions offer improvements, and changes over time. This means that functions that work in some versions do not work in others. So you need to verify which version of PHP code has been written for, and also think about using common functions in your code to prevent issues with running it on new versions of PHP.
To learn PHP you’ll need a LAMP server of some sort, a text editor, and a good study guide. I highly recommend buying a book because it’s an excellent UI while learning a language.