0% found this document useful (0 votes)
3 views9 pages

Evolution of Web Development & PHP Basics

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)
3 views9 pages

Evolution of Web Development & PHP Basics

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

WBDV 211

PRELIMS

2 INTRODUCTION INTRODUCTION TO PHP

Introduction to Advanced Web Development ●​ PHP stands for "Hypertext Preprocessor."


Evolution of Web Development: Web 1.0 → Web 5.0 ●​ A server-side scripting language primarily
used for web development.
Web 1.0 (Static Web) – 1990s ●​ Created in 1994 by Rasmus Lerdorf.
●​ Read-only, static HTML pages with text and
images
●​ No interaction, just information display EARLY BEGINNINGS (1994-1997)
●​ Example: Early Yahoo, AOL Pages ●​ 1994: Rasmus Lerdorf developed PHP Tools to
maintain his personal website.
Web 2.0 (Social Web) – 2000s ●​ Originally called "Personal Home Page Tools."
●​ Interactive and collaborative: users can ●​ 1995: Released to the public as PHP/FI,
upload, comment, and share content supporting forms and databases.
●​ Blogs, forums, and social media explode
●​ User-generated content is the core PHP 3 (1997-1998)
●​ Example: Facebook, YouTube ●​ 1997: Zeev Suraski and Andi Gutmans rewrote
PHP/FI, leading to PHP 3.
Web 3.0 (Semantic Web) – 2010s ●​ Collaboration with Lerdorf resulted in a
●​ Uses AI, big data, and semantic understanding fully-fledged scripting language.
to personalize results ●​ Renamed to "Hypertext Preprocessor."
●​ Recommendations: “Because you watched...” or ●​ 1998: PHP 3 was officially released.
“Suggested for you”
●​ Linked data makes machines understand PHP 4 (2000)
context ●​ 2000: Introduction of the Zend Engine by
●​ Example: Netflix Suraski and Gutmans.
●​ Significant performance improvements and
Web 4.0 (Intelligent/Autonomous Web) – Present new features.
●​ AI + IoT integration for predictive and ●​ Became the standard for dynamic web
autonomous services development.
●​ Systems act like intelligent assistants, not just
tools PHP 5 (2004)
●​ Example: Amazon Alexa, Tesla Autopilot, ●​ 2004: Release of PHP 5 with the Zend Engine II.
Google Assistant ●​ Enhanced object-oriented programming
support.
Web 5.0 (Emotional/Web of Emotions) – Emerging ●​ Introduction of PHP Data Objects (PDO) for
●​ Focuses on emotional recognition and database access.
empathy
●​ Uses AI to detect and respond to human THE PHP 6 PROJECT (2005-2010)
emotions ●​ 2005-2010: Aim to introduce full Unicode
●​ VR and AR platforms that adapt based on support.
mood/behavior ●​ Faced numerous challenges, leading to its
●​ Example: Replika AI, Emotive VR/AR platforms, abandonment.
Affectiva (emotion AI) ●​ Concepts integrated into PHP 5.x instead.

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.

1 jeon wonwoo uuwi sa 2027


WBDV 211
PRELIMS

●​ Further enhanced performance and


modernized PHP.

WHY USE PHP? ​


●​ Easy to learn for beginners. ​
●​ Highly flexible and widely supported. ​
●​ Integrates seamlessly with HTML, CSS, and ​
JavaScript. ​
●​ Extensive library of built-in functions. ​
●​ Large community and extensive
documentation. PHP COMMENTS, CONSTANTS, AND VARIABLES
●​ Cross-platform compatibility (works on
Windows, macOS, Linux).
PHP COMMENTS
●​ Comments are used to leave notes in your
HOW PHP WORKS
code.
●​ Server-Side Execution: PHP scripts run on the
●​ Single-line comments:
server.
○​ Use // or # for single-line comments.
●​ Embedded in HTML: PHP code can be inserted
○​ Example: // This is a single-line
directly into HTML.
comment
●​ Dynamic Content: PHP can generate dynamic
●​ Multi-line comments:
web pages based on user input or other data.
○​ Use /* ... */ for comments spanning
●​ Output: The server processes the PHP code and
multiple lines.
sends the generated HTML back to the user's
○​ Example: /* This is a multi-line
browser.
comment that spans multiple lines. */

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
​ ?>

TAGS SYNTAX RULES FOR VARIABLE NAMING


●​ Must start with a letter or underscore (_).
Short Style <?[code here] ?> ●​ Cannot start with a number.
●​ Can contain alphanumeric characters and
XML Style <?php{code here}?> underscores.
VARIABLE VARIABLES
Script Style <script language = “php”>[code]
●​ A variable variable means that the name of a
here</script>
variable can itself be stored in another variable.
ASP Style <%]code here] %> POTENTIAL USE CASES
●​ Dynamic Naming: When you need to create
variables dynamically based on user input or
BASIC PHP SYNTAX other data.
●​ PHP code is enclosed within <?php ... ?> tags. ●​ Looping Through Data: Sometimes used in
●​ Statements end with a semicolon (;). loops where variable names need to be
●​ PHP supports variables, arrays, functions, and generated dynamically.
more. ●​ Code Readability: Variable variables can make
●​ The echo command is used to print text back the code harder to read and understand,
to the browser. especially in large applications. It’s often better
​ to use arrays or objects if possible.
CODE BLOCK ●​ Alternative Approaches: If the need for
●​ A code block is simply a series of statements dynamic variable names arises, consider using
enclosed between two braces:

2 jeon wonwoo uuwi sa 2027


WBDV 211
PRELIMS

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

Web performance optimization refers to the process of


ESCAPE SEQUENCES
making websites load faster, respond better, and
Single Quotes (' '):
provide a smooth user experience.
●​ Recognize only the escape sequences for single
quotes (\') and backslash (\\).
The Psychology of Web Speed
(User Patience Threshold)
echo 'It\'s a sunny day'; // Outputs: It's a
sunny day
User expectations- Studies suggest users expect web
pages to load within 2–3 seconds.
Double Quotes (" "):
●​ Recognize a wider range of escape sequences,
Behavioral impacts - Slow sites lead to higher bounce
including \n (newline), \t (tab), \$ (dollar sign),
rates.
\" (double quote), and more.

Analogy - Waiting for a slow website is like waiting in a


echo "Line 1\nLine 2"; // Outputs: Line 1
long queue—most people will leave if it takes too long.
// Line 2

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 jeon wonwoo uuwi sa 2027


WBDV 211
PRELIMS

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

Modern web performance is measured using Core Web


Vitals and related metrics.

[Link] (Time to First Byte)


a. Measures how long it takes for the browser to receive
the first byte of data from the server.
b. Lower TTFB = better server response.
[Link] (First Contentful Paint)
a. Measures when the browser first renders any content
(text, image, SVG, etc.) on screen.
b. Important for user perception of speed.
[Link] (Largest Contentful Paint)
a. Measures when the largest visible content (e.g., hero
image, heading) is rendered.
b. Should ideally happen within 2.5 seconds.
[Link] (Cumulative Layout Shift) LOCAL SCOPE
a. Measures visual stability (unexpected layout shifts
during loading). • Variables declared inside a function have a local
b. Lower CLS = smoother experience (no annoying scope.
jumps). • Local variables are only accessible within the function
in which they are declared.
Things to Remember! • Once the function execution ends, local variables are
destroyed.
1. Statements are expressions terminated by
semicolons.
2. Expressions are combinations of tokens.
3. Braces make blocks.

Variables

1. All variables in PHP are denoted with a leading dollar


sign ($).
2. The value of a variable is the value of its most recent
assignment.
3. Variables are assigned with the = operator, with the
variable on the lefthand side and the expression to be
evaluated on the right.
4. Variables can, but do not need, to be declared before
assignment.
5. Variables in PHP do not have intrinsic types - a STATIC SCOPE
variable does not know in advance whether it will be
used to store a number or a string of characters. • The static keyword is used to preserve the value of a
6. Variables used before they are assigned have local variable between function calls.
default values. • Normally, when a function completes, its local
7. PHP does a good job of automatically converting variables are destroyed. However, a static variable
types from one to another when necessary. retains its value for the next time the function is called.

VARIABLE SCOPE - A variable's scope determines the FUNCTION PARAMETERS


locations from which the variable can be accessed.
• Function parameters also have local scope within the
GLOBAL SCOPE function.
• Variables declared outside of any function or class • They are treated as local variables that receive their
have a global scope. values from the arguments passed to the function.

4 jeon wonwoo uuwi sa 2027


WBDV 211
PRELIMS

and functions that are specific to the class.


8. Resources − are special variables that hold
references to resources external to PHP (such as
database connections).

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.

• Superglobals are built-in variables that are always


accessible, regardless of scope. TYPES OF PHP OPERATORS
• Examples include $_POST,
$_GET, $_SESSION, $_COOKIE,
ARITHMETIC OPERATORS - Arithmetic operators are
$_SERVER, $GLOBALS, etc.
used to perform basic mathematical operations.
• They are accessible from anywhere in the script,
whether in functions, classes, or global
space.

`​ ​ SUPERGLOBAL SCOPE

ASSIGNMENT OPERATORS - Assignment operators are


PHP Data Types used to assign values to variables.

1. Integers − are whole numbers, without a decimal


point, like 4195.
2. Doubles − are floating-point numbers, like 3.14159 or
49.1.
3. Booleans − have only two possible values either true
or false.
4. NULL − is a special type that only has one value: NULL.
5. Strings − are sequences of characters, like 'PHP
supports string operations.'
6. Arrays − are named and indexed collections of other
values.
7. Objects − are instances of programmer-defined
classes, which can package up both other kinds of

values

5 jeon wonwoo uuwi sa 2027


WBDV 211
PRELIMS











​ INCREMENT/DECREMENT OPERATORS - These operators
​ are used to increment or decrement a variable's value.

COMPARISON OPERATORS - Comparison operators are


used to compare two values, returning true or false.

ARRAY OPERATORS - Array operators are used to


compare or combine arrays.

LOGICAL OPERATORS - Logical operators are used to


combine conditional statements.

6 jeon wonwoo uuwi sa 2027


WBDV 211
PRELIMS

Z-pattern: It follows the natural movement of the eye


from top-left to top-right, then down to the bottom-left,
4 CONTROL STRUCTURES
and finally to the bottom-right. It is often used in
designs with minimal text and heavy visuals.

Information Architecture (IA) - Organizing and


F-pattern: It is more used for text-heavy content, such
structuring content for clarity.
as blogs or articles. The audience will first look at the
top (reading the headline), then move down the left
Content Strategy - Planning, creating, and managing
side. It’s useful for structuring
content so it meets user needs and business goals.

SEO Foundations Without Coding - Search Engine


Optimization (SEO) is not just technical—it also
Structuring Websites for Clarity and Navigation
depends on semantic clarity and keyword strategy.

Website Navigation - is the link structure and hierarchy Semantic Structure


guiding users to their destination in as few steps as - Use clear headings (H1, H2, H3) to show hierarchy.
possible. - Keep paragraphs short and focused on one idea.
- Use descriptive anchor text for links (e.g., “Learn about
4 Types of Website Navigation pricing” instead of “Click here”).

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.

7 jeon wonwoo uuwi sa 2027


WBDV 211
PRELIMS

Benefit: Enhances SEO and improves search engine


indexing.

CONTROL STRUCTURES

●​ Control structures are fundamental building


blocks in programming. They determine the
flow of control within a script, allowing you to
make decisions, repeat actions, and handle
LOOP STRUCTURES - Loops are used to execute a block
various conditions. PHP provides several types
of code repeatedly as long as a
of control structures, including conditional
specified condition is met.
statements (if, else, elseif, switch) and loops
(while, do-while, for, foreach).
1.​ WHILE LOOP - The while loop executes a block
of code as long as the condition is true.
CONDITIONAL STATEMENT

1.​ IF STATEMENT - The if statement is used to


execute a block of code only if a specified
condition is true.

2.​ DO...WHILE LOOP - The do...while loop is similar


to the while loop, but it guarantees that the
block of code is executed at least once.
2.​ IF...ELSE STATEMENT - The if...else statement
extends the if statement by adding an
alternative block of code to execute if the
condition is false.

3.​ FOR LOOP - The for loop is used when the


number of iterations is known. It is often used to
iterate over arrays.
3.​ IF...ELSEIF...ELSE STATEMENT - This statement
allows you to check multiple conditions in
sequence.

4.​ FOREACH LOOP - The foreach loop is used to


iterate over arrays. It assigns the current array
element to a variable on each iteration.


4.​ SWITCH STATEMENT - The switch statement is
used to perform different actions based on the
value of a variable or expression

8 jeon wonwoo uuwi sa 2027


WBDV 211
PRELIMS

CONTROL STRUCTURE BEST PRACTICES

●​ Use braces {} even for single-line blocks to


improve code readability.
●​ Keep conditions simple and avoid complex
nested structures where possible.
●​ Comment your code to explain the purpose of
your conditions and loops.

9 jeon wonwoo uuwi sa 2027

You might also like