PHP

Syntax

PHP / Syntax

Syntax

Basic PHP Syntax

A PHP script is executed on the server, and the result is sent back to the browser as plain HTML output.

A PHP script can be written anywhere inside a web page.

PHP code always starts with . These tags tell the server where the PHP code begins and ends.

Example

 


 // PHP code goes here


?>

PHP Case Sensitivity

PHP is partially case sensitive, which means some parts are case sensitive and some are not.

  1. Variables are case sensitive

   2. Keywords are NOT case sensitive

   3. Functions are NOT case sensitive

In PHP, variables are case sensitive, but keywords and functions are not case sensitive.

Example

// Variable is case sensitive
$name = "Rahul";

// This works because variable name is correct
echo $name;   // Output: Rahul

// This will cause an error because $Name is different from $name
// echo $Name;   // Error: Undefined variable

// PHP keywords/functions are NOT case sensitive

ECHO "Hello";   // Works
echo "Hello";   // Works
EcHo "Hello";   // Works

?>

Technology
PHP
want to connect with us ?
Contact Us