A shortened version of weblog.

A shortened version of weblog.

PHP Syntax & Case Sensitivity

  • Programming
  • 04 May 2022
  • 1429 Views
  • Sathiyamoorthy V

A PHP script can be placed anywhere in the document.

A PHP script starts with <?php and ends with ?>

Basic PHP Syntax

<?php
// PHP code goes here
?>

The default file extension for PHP files is ".php"

Example

<html>
<body>
<h1>My first PHP page</h1>
<?php
echo "Hello World!";
?>
</body>
</html>

Output

My first PHP page
Hello World!

PHP Case Sensitivity

In PHP, keywords (e.g. if, else, while, echo, etc.), classes, functions, and user-defined functions are not case-sensitive.

All variable names are case-sensitive!

Example

<html>
<body>
<?php
ECHO "Hello World!<br>";
echo "Hello World!<br>";
EcHo "Hello World!<br>";

$color = "red"; echo "My car is " . $color . "<br>";
echo "My house is " . $COLOR . "<br>";
echo "My boat is " . $coLOR . "<br>";
?>
</body>
</html>

Output

Hello World!
Hello World!
Hello World!

My car is red
My house is
My boat is

RELATED POST

27 April 2022   |   Programming
Bootstrap 5 Introduction
Read More
25 April 2022   |   Programming
Node.js Introduction
Read More
24 April 2022   |   Programming
Angular Framework Introduction
Read More
11 May 2022   |   Programming
PHP Comments Syntax
Read More
11 May 2022   |   Programming
Bootstrap 5 Basic Page Example
Read More
12 May 2022   |   Programming
Bootstrap 5 Containers
Read More
PHP Syntax & Case Sensitivity
https://blogbyte.in/blog-details/?cid=2&pid=20

LEAVE A COMMENT

+