This post should help you understand the two languages better.
PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language especially suited for server-side web development. PHP is used to create dynamic and interactive websites.
<!DOCTYPE html> <html> <head> <title>Example</title> </head> <body> <?php echo "Hi, I'm a PHP script!"; ?> </body> </html>
The PHP code is embedded in the HTML code and it has a special start and end processing instructions <?php ……. ?>. This allows you to jump into and out of “PHP mode.”
How are they similar and how do they differ? Few salient features:
Open Source, hence FREE
Both are interpreted languages, which means that you can make changes to your code and run it again to see the effect without having to recompile the code.
If you would like to develop a full-fledged website and host it then PHP could be your preferred choice. The PHP code is simple, it is free, and your code can run on any platform. It has a huge set of standard libraries hence application development is fast. Some of the popular PHP frameworks are Laravel, Symfony, Zend and CodeIgnitor and many more. If you are comfortable with Object Oriented Programming and are familiar with the usage of libraries and frameworks, then PHP should be your choice as it has a large developer community support!
To sum it up, you can use either of them or both collaboratively depending on your application development needs.