0
0
PHPprogramming~10 mins

What is PHP - Visual Explanation

Choose your learning style9 modes available
Concept Flow - What is PHP
User requests a web page
Web server receives request
Server runs PHP code
PHP processes data and logic
PHP sends HTML output
Browser displays the page
PHP runs on the web server to process code and send back HTML for the browser to show.
Execution Sample
PHP
<?php
  echo "Hello, world!";
?>
This PHP code sends the text 'Hello, world!' to the browser.
Execution Table
StepActionCode ExecutedOutput Produced
1Start PHP script<?php
2Execute echo statementecho "Hello, world!";Hello, world!
3End PHP script?>
💡 PHP script ends and output is sent to browser
Variable Tracker
VariableStartAfter echoFinal
No variables---
Key Moments - 2 Insights
Why does PHP code run on the server and not in the browser?
PHP is a server-side language, so it runs on the web server before the page is sent to the browser, as shown in the concept flow and execution table steps 1 and 3.
What does the echo statement do in PHP?
Echo sends text to the output that the browser will display, as seen in execution table step 2 where 'Hello, world!' is produced.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what output is produced at step 2?
APHP code
BNo output
CHello, world!
DError message
💡 Hint
Check the 'Output Produced' column at step 2 in the execution table.
At which step does the PHP script end?
AStep 2
BStep 3
CStep 1
DThere is no end
💡 Hint
Look at the 'Action' column for the step where PHP script ends.
If we add a variable to store 'Hello', where would it appear in the variable tracker?
AIn all columns after it is set
BIn the 'Start' column
CIn the 'Final' column
DIn the 'After echo' column
💡 Hint
Variables change over time, so track their values from start to final in the variable tracker.
Concept Snapshot
PHP is a server-side language.
It runs on the web server.
PHP code generates HTML output.
Use <?php ... ?> tags.
Echo sends output to browser.
Browser shows the final page.
Full Transcript
PHP is a programming language that runs on a web server. When a user asks for a web page, the server runs PHP code to create the page content. The PHP code can do things like show text or work with data. After running, PHP sends the result as HTML to the user's browser. The browser then shows the page. For example, the PHP code '<?php echo "Hello, world!"; ?>' sends the text 'Hello, world!' to the browser. PHP code runs step by step on the server, starting with the PHP tags, then the echo command, and finally ending the script. Variables in PHP can hold data and change as the code runs. This process helps make web pages dynamic and interactive.