محاضرة 2
Fundamentals of PHP
أساسيات لغة PHP: المتغيرات، أنواع البيانات، والجمل الشرطية.
يلا نشوف الملخص
Lecture 2: Fundamentals of PHP
Overview: This lecture covers the basics of PHP, a server-side scripting language embedded in HTML.
- Introduction to PHP:
- PHP manages dynamic content, databases, session tracking, and builds e-commerce sites.
- It integrates with databases like MySQL, PostgreSQL, Oracle, etc.
- PHP performs system functions, handles HTML forms, adds/modifies databases, accesses cookies, and can encrypt data.
- Environment Setup:
- Requires a server (e.g., Apache), a database (e.g., MariaDB), and PHP.
- Easy-to-install bundles include Wamp, XAMPP, and Laragon.
- Basic PHP Syntax:
- A PHP script begins with
<?phpand ends with?>. - Variables: Start with a
$sign. The name must start with a letter or underscore, cannot start with a number, contains only alphanumeric characters and underscores, and is case-sensitive.
- A PHP script begins with
- Output Statements:
echoandprintare used to output text and variables to the screen and are mostly identical.
- Data Types:
- String, Integer, Float (double), Boolean, Array, Object, NULL, Resource.
- The
var_dump()function returns the data type and the exact value of a variable.
- Math Built-in Functions:
pi(),min(),max(), andround().
- Conditional Statements:
- If Statements: Executes code if a specified condition evaluates to true.
- Switch Statement: Chooses one of many blocks of code to execute. Uses the
breakkeyword to stop execution and adefaultblock if no matches are found.
في نقطة مش واضحة؟ بطبط موجود!
اسأل بطبط عنها