0% found this document useful (0 votes)
2 views

PHP

Uploaded by

selinasacc190
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

PHP

Uploaded by

selinasacc190
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

 XAMPP Full Form & Services on Control Panel

 Full Form: Cross-platform (X), Apache (A), MariaDB (M), PHP (P), Perl (P).
 Services: Apache, MySQL (MariaDB), FileZilla, Mercury, and Tomcat.

 REST & Request Methods of REST

 REST (Representational State Transfer) is an architectural style for designing


networked applications.
 Request Methods: GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD.

 PHP Version

 PHP versions update frequently. XAMPP typically includes a recent stable PHP
version (check XAMPP’s documentation for the specific version bundled with it).

 MySQL Version

 MySQL version in XAMPP also varies, commonly MySQL 5.6 or MariaDB as a


replacement.

 XAMPP Version

 The XAMPP version also varies. Check "Help" in XAMPP Control Panel or
XAMPP’s website.

 PHP Functions to Use MySQL

 Common functions include mysqli_connect(), mysqli_query(), and


mysqli_close(); or the PDO functions like new PDO().

 Global, Static, Local Variables

 Global: Accessible throughout the script, defined outside functions.


 Static: Maintains value even after the function exits.
 Local: Defined within a function, accessible only there.

 $ and & Difference

 $ is for declaring variables, & is used to pass by reference (shares the memory address
of a variable).

 GET vs POST in PHP

 GET: Sends data via URL, limited size, less secure.


 POST: Sends data in the HTTP request body, larger, more secure for sensitive data.

 Types of Variables in PHP


 PHP supports integers, floats, strings, booleans, arrays, objects, NULL, and resources.

 Types of Variables in PHP

 See answer 10 (variables types are repeated here).

 Number of Ports in a Computer

 There are 65,535 TCP and 65,535 UDP ports available.

 Sessions vs. Cookies

 Sessions: Server-side, more secure, no storage limit.


 Cookies: Client-side, can be modified by users, limited to ~4KB.

 PUT Request Method

 Used to update an existing resource. Unlike POST, it is idempotent (repeated requests


yield the same result).

 Types of Arrays in PHP

 Indexed, Associative, and Multidimensional arrays.

 MySQL vs. MySQLi

 MySQL: Older extension, no support for prepared statements.


 MySQLi: Improved, supports prepared statements, procedural, and object-oriented.

 Cookie Without Expiry

 If no expiration date is set, the cookie is considered a session cookie and will end
when the browser is closed.

 REST API: What, Why, How

 What: A method to create scalable APIs.


 Why: Stateless, efficient, supports different formats.
 How: Uses HTTP methods, JSON/XML data format.

 Session vs. Cookie

 Session: Stored server-side, identified by session ID.


 Cookie: Stored client-side, data persists based on expiration.

 cURL in PHP

 A tool to make HTTP requests in PHP, allowing interaction with other servers or
APIs.
 Three PDO Functions

 prepare(), execute(), fetch().

 Execute Query vs. Execute Non-Query

 Execute Query: For statements that return data (SELECT).


 Execute Non-Query: For statements that don’t return data (INSERT, UPDATE,
DELETE).

 Three Mail Protocols

 SMTP (Sending), POP3 (Receiving), IMAP (Receiving).

 Difference Between Echo and Print

 Echo: Faster, can take multiple parameters.


 Print: Slower, returns 1, can only take one argument.

 Prepared Statement

 Used to safely execute SQL statements, prevents SQL injection.

 PDO (PHP Data Objects)

 A database access layer for multiple DBs, secure (supports prepared statements), and
flexible.

 Creating an API

 Define routes, set up endpoints, use HTTP methods, and ensure JSON or XML data
format.

 Types of Email Protocols

 SMTP: Sending emails.


 POP3: Downloading emails, removes from the server.
 IMAP: Syncs emails across devices.

 XAMPP: Emphasize that XAMPP is a development environment and not intended for
production use due to default open ports and settings that are less secure.

 REST: Mention that REST APIs are stateless, meaning each request is processed
independently, which enhances scalability.

 PHP Version: Add that PHP updates can improve security and performance and may
introduce or deprecate functions.
 MySQL/MariaDB Version: Highlight that newer versions offer performance
improvements, security updates, and additional features.

 XAMPP Version: Knowing the XAMPP version can help troubleshoot compatibility
issues with specific PHP, MySQL, or Apache versions.

 PHP MySQL Functions: If using mysqli_* functions, recommend checking


mysqli_error() for debugging SQL errors.

 Global, Static, Local Variables: Mention that overuse of global variables can make code
harder to debug, while static variables are useful in recursive functions.

 $ vs. & Difference: Explain that & allows for changes in one variable to reflect in another,
which is useful in functions where you want a parameter’s value to persist outside the
function.

 GET vs POST: Emphasize that GET requests are useful for fetching data, while POST is
ideal for sending data, especially when security is a concern.

 Variable Types: For objects, highlight that they allow object-oriented programming,
making PHP code modular and easier to maintain.

 Computer Ports: In addition to 65,535 TCP/UDP ports, mention physical ports like USB,
HDMI, and Ethernet that facilitate connectivity with peripherals.

 Sessions vs Cookies: Sessions are stored server-side and often have a shorter lifespan,
making them more secure and less exposed to manipulation.

 PUT Request: Mention that PUT is often used to replace entire resources, while PATCH
(a related HTTP method) updates only specific fields.

 PHP Arrays: Note that PHP arrays are flexible and can hold different data types, even
within the same array.

 MySQL vs MySQLi: MySQLi’s object-oriented interface and prepared statements make it


a more secure and flexible choice for database interactions.

 Session Cookie: Explain that session cookies can enhance user experience, preserving
login status or user preferences for a single browsing session.

 REST API: REST’s stateless nature and caching support make it well-suited for web
services, particularly those with high traffic.

 Session vs. Cookie Storage: Sessions are stored on the server and identified by a session
ID, which the browser keeps in a cookie. Cookies are stored directly in the browser.

 cURL in PHP: Explain that cURL can handle various protocols (FTP, HTTP, HTTPS),
making it useful for API requests and data integration.
 PDO Functions: In addition to prepare(), execute(), and fetch(), mention
beginTransaction() and commit() for managing transactions.

 Execute Query vs Execute Non-Query: Mention that non-query executions (like updates
or inserts) don’t require fetching, which saves resources.

 Mail Protocols: IMAP syncs messages across devices, while POP3 is best for devices that
check mail infrequently.

 Echo vs Print: In larger scripts, echo is preferable for performance, especially when
outputting large amounts of data.

 Prepared Statements: These are particularly important for preventing SQL injection by
binding user input as parameters rather than directly into the query.

 PDO vs MySQLi: PDO is database-agnostic, allowing code portability across databases


like PostgreSQL or SQLite, unlike MySQLi, which is MySQL-specific.

 Creating an API: After defining routes and endpoints, mention that validating and
sanitizing inputs is crucial for security.

 Email Protocols: SMTP is specifically for sending, and clients often use IMAP or POP3
for receiving, based on how they want to manage email storage.

You might also like