What are the differences between PHP and JavaScript in terms of functionality and execution?

PHP is a server-side scripting language, meaning it runs on the server before the page is loaded in the browser. JavaScript, on the other hand, is a client-side scripting language that runs in the browser after the page has been loaded. PHP is used for server-side tasks like interacting with databases and generating dynamic content, while JavaScript is used for client-side tasks like form validation and interactivity on the webpage.

// PHP code snippet
<?php
echo "Hello, World!";
?>