Evolution of Web Development & PHP Basics
Evolution of Web Development & PHP Basics
PRELIMS
PHP 7 (2015)
● 2015: Introduction of PHP 7 with Zend Engine 3.0.
● Significant performance improvements and
new features.
● Introduced scalar type declarations, return
type declarations.
PHP 8 (2020)
● 2020: Released with the JIT (Just-In-Time)
compiler.
● New features: union types, named arguments,
and attributes.
TESTING BED:
PHP VARIABLES
● Apache
● Variables are used to store data that can be
● Php
used and manipulated later.
● MySQL
● A variable starts with the $ sign, followed by
● XAMMP
the name of the variable.
● WAMMP
● Variable names are case-sensitive.
● LARAVEL
● VS Code
<?php
● Notepad++
$name = “Wonwoo”;
$age = 16;
PHP TAGS
?>
associative arrays, where the keys can act like ● They do not start with a $ symbol.
variable names. ● Useful for values that should remain constant
throughout the script, like configuration
VARIABLE INTERPOLATION settings.
Single Quotes (' '): ECHOING VARIABLES AND TEXT STRINGS
● Do not interpret variables or special ● The echo statement is used to output data to
characters inside the string. the screen.
● The content is taken literally. ● You can echo variables, strings, and HTML.
$name = "Wonwoo"; ● Use the . operator to concatenate (join)
echo 'Hello, $name'; //Outputs: Hello, $name variables and strings.
Double Quotes (" "): <?php
● Interpret variables and certain escape $name = "Sheinn";
sequences within the string. echo "Hello, " . $name;
● The value of the variable is inserted into the ?>
string.
$name = "Wonwoo";
3 OPERATIONS
echo "Hello, $name"; //Outputs: Hello,
Wonwoo
PERFORMANCE
Critical Rendering Path (CRP)
Single Quotes (' '):
The Critical Rendering Path is the sequence of steps
● Slightly faster than double quotes because
browsers take to convert HTML, CSS, and JavaScript into
PHP doesn't need to parse the string for
pixels on the screen.
variables or escape sequences.
● Best used when you have a simple string
Steps in the CRP:
without variables or special characters.
Double Quotes (" "):
• HTML Parsing → DOM creation
● Slightly slower because PHP scans the string
• CSS Parsing → CSSOM creation
for variables and escape sequences to process.
• JavaScript execution (if blocking)
● Useful when you need to embed variables or
• Render Tree construction (DOM + CSSOM combined)
special characters.
• Layout (reflow) – computing element positions
• Painting (rasterization) – pixels drawn on the screen
PHP CONSTANTS
● Constants are similar to variables, but their
Caching, Lazy Loading, and CDN
value cannot be changed after being set.
● Define constants using the define() function.
1. Caching - Storing frequently used resources (images,
CSS, scripts) locally on the user’s device or in
<?php
intermediate servers.
define("SITE_NAME", "MyWebsite");
2. Lazy Loading - Delaying the loading of non-critical
echo SITE_NAME;
resources (e.g.,
?>
images below the fold) until they are actually needed.
KEY CHARACTERISTICS
● Constants are automatically global.
3. Content Delivery Network (CDN) - A globally • Global variables are accessible from anywhere
distributed network of servers that deliver web content outside of functions, but not directly inside functions.
from the server closest to the user. • To access a global variable inside a function, you
need to use the global keyword.
Performance Metrics
Variables
OPERATORS
In PHP, operators are symbols or keywords used to
perform operations on variables and values. They are
an essential part of any programming language,
allowing developers to manipulate data, perform
SUPERGLOBAL SCOPE calculations, and control the flow of a program.
` SUPERGLOBAL SCOPE
INCREMENT/DECREMENT OPERATORS - These operators
are used to increment or decrement a variable's value.
1. The top menu, or main menu, is the primary Keyword Theory
website navigation bar that's positioned at the - Research what users search for (Google Keyword
top of every website. Planner, SEMrush).
2. The second type of website navigation is the - Focus on long-tail keywords (specific phrases) for
footer menu. Some websites have an in-depth targeted traffic.
footer menu, whereas others keep it simple with - Place keywords naturally in titles, headings, and
only a handful of pertinent links. introductory text.
3. A third type of website navigation that is often
seen on ecommerce and other content heavy User Intent
sites is a sidebar. - Identify if users want informational (learn),
4. The fourth type of website navigation is called navigational (find), or transactional (buy) content.
breadcrumbs. These are hierarchical links that - Tailor content to meet those needs.
show how pages are nested within each other.
Taxonomies and Metadata
Best practices for website navigation Organizing content goes beyond menus—it requires
invisible structures that search engines and
● Keep it simple systems understand.
● Make it visible
● Create separation Taxonomy - A system of classification that groups
● Only use buttons for calls to action related content.
● Order links by priority
● Optimize for mobile Types:
● Use descriptive labels Hierarchical: Categories and subcategories (e.g.,
● Avoid format-based navigation labels Electronics > Mobile > Android).
● Avoid little drop down menus Faceted: Multiple attributes for filtering (e.g., filter by
brand, price, size).
Theories of Content Hierarchy
Benefit: Makes large websites manageable and
● The Inverted Pyramid of writing, commonly improves findability.
employed in Journalism
Metadata - Data about data. It describes content for
both humans and machines.
Types:
Descriptive metadata: Title, keywords, description.
Structural metadata: How content is organized
(chapters, page numbers).
Administrative metadata: Author, copyright, dates.
CONTROL STRUCTURES
4. SWITCH STATEMENT - The switch statement is
used to perform different actions based on the
value of a variable or expression