Comments are used to make your code easier to read and maintain. PHP provides three types of comments:
//
[Shortcut: Ctrl + /]<?php // Print a greeting message echo "Hello World!"; ?>
#
(Old style) [Shortcut: Manual]<?php # This method is less common but still works echo "Using hash comments!"; ?>
/* ... */
[Shortcut: Ctrl + Shift + /]<?php /* This function displays a user's profile. You can customize it to show name, email, and photo. */ echo "User Profile"; ?>
<?php $price = 100; // Base product price $tax = 0.15; // 15% VAT ?>
<?php // echo "This line won't run"; echo "This line will run"; ?>
<?php /* Function: greetUser Purpose: Display a greeting message Input: $name (string) */ function greetUser($name) { echo "Welcome, $name!"; } ?>