You are on page 1of 2

V.

PHP: Hypertext Preprocessor


A.
5.1 What is PHP?
5.2 What is a PHP File?
5.3 What Can PHP Do?
5.4 Why PHP?

B.
5.5 Set Up PHP on Your Own PC
5.6 Basic PHP Syntax
5.7 Comments in PHP

C.
5.8 PHP Variables
5.9 Creating (Declaring) PHP Variables
5.10 PHP is a Loosely Typed Language

D.
5.11 PHP Variable Scopes
5.12 Local Scope
5.13Global Scope

LAB:
 what is phpMyAdmin?
 features of phpMyAdmin
 benefits of phpMyAdmin
 MS access vs phpMyAdmin
 Instruction on how to open phpMyAdmin
NOTE: first install xampp -> apache, mysql
 Demo the phpMyAdmin
NOTE: start apache and mysql in xampp, click admin on mysql or type ‘localhost/phpmyadmin’ on browser.
 Create a sample database in phpMyAdmin
o using phpMyAdmin gui
o demo using in sql code
 Create a php file and code some html and php and access it in browser through localhost
NOTE: the php code must be in ‘xampp/htdocs/[newFolder]/.index.php’, so you can access it in browser through
this ‘localhost/folderName/index.php’

SW1:
Create a database in phpMyAdmin
dbName:
dbColumns:

SW2:
Supply it with
C. MY PART
5.8 PHP Variables

5.9 Creating (Declaring) PHP Variables

5.10 PHP is a Loosely Typed Language


PHP is often described as a loosely typed language because it allows variables to be dynamically assigned
without explicitly defining their data types. In PHP, you can assign different types of values to a variable without
any type enforcement or strict type checking. For example, you can assign an integer to a variable and later
assign a string to the same variable without any issues.

This flexibility can be seen as a double-edged sword. On one hand, it provides convenience and flexibility by
allowing developers to easily work with different types of data without having to explicitly convert or cast values.
It simplifies the coding process and can lead to faster development.

On the other hand, the lack of strict typing can sometimes lead to unexpected results or bugs. Since PHP does
not enforce strict type checking by default, it can perform implicit type conversions that may not align with the
developer's intentions. This can cause issues when dealing with complex calculations or comparisons, as the
expected behavior may not be what actually occurs.

However, it's worth noting that PHP has evolved over the years, and as of PHP 7, it introduced stricter typing
options through features like type declarations and return type declarations. These allow developers to specify
the expected types of function arguments and return values, bringing more type safety to PHP code.

Overall, PHP's loosely typed nature has been a defining characteristic of the language, but recent versions have
introduced mechanisms to enhance type safety and reduce potential issues related to loose typing.

You might also like