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