PHP
PHP
PHP
Full Form: Cross-platform (X), Apache (A), MariaDB (M), PHP (P), Perl (P).
Services: Apache, MySQL (MariaDB), FileZilla, Mercury, and Tomcat.
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
XAMPP Version
The XAMPP version also varies. Check "Help" in XAMPP Control Panel or
XAMPP’s website.
$ is for declaring variables, & is used to pass by reference (shares the memory address
of a variable).
If no expiration date is set, the cookie is considered a session cookie and will end
when the browser is closed.
cURL in PHP
A tool to make HTTP requests in PHP, allowing interaction with other servers or
APIs.
Three PDO Functions
Prepared Statement
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.
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.
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.
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.
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.