Technically the web server always runs first. It doesn't understand PHP itself, but must be configured to detect whether the location requested by the client (browser) contains PHP segments or not. For example, any file with extension ".php" may be processed by invoking the PHP which interprets the PHP segments and feeds the entire HTML back to the server. It then returns that complete content back to the client.
add a note
User Contributed Notes
Introduction - [2 notes]
imajeffs at hotmail dot com ¶
3 years ago
winks716 ¶
5 years ago
before html runs to show a webpage, php code runs first on web server.
so, when there lines as follow:
<table>
<tr>
<td>
<?php
echo "php runs first!";
?>
</td>
</tr>
</table>
the first step is to run php code, we get:
<table>
<tr>
<td>
php runs first
</td>
</tr>
</table>
then, code is sent to browser, and we see somthing~