PHP: Difference between revisions

118 bytes added ,  15:15, 23 May 2020
m
Line 36: Line 36:
=== Advantages of PHP scripts ===
=== Advantages of PHP scripts ===


PHP is relatively easy to learn, because it can be used either in a very simple way, or when you learn more in a very sophisticated way.  One advantage of PHP scripts is because they are processed by the web server nobody can steal your script unless you use some functionality like that [https://cumulus.hosiene.co.uk/viewtopic.php?f=14&t=16425&p=126065 described here]. If you are writing a set of web pages, you can make your web suite very much easier to maintain by not putting every instruction into one script, you can use syntax like 'require' or 'include' to effectively bring in common code from other scripts. These other scripts might contain standard functions (like connecting to a database, reading from a database and calculating highest or lowest) or they might contain a standard navigation header that you want for all your web pages (with ability to identify which script is the current one, which CSS files to attach, and so on). But the basic reason for using a script is that it can make a web page look different depending on any data you choose (time of day, current season, whether it is raining, how hot it is) or it can display different content depending on particular values.
PHP is relatively easy to learn, because it can be used either in a very simple way, or when you learn more in a very sophisticated way.  One advantage of PHP scripts is because they are processed by the web server nobody can steal your script unless you use some functionality like that [https://cumulus.hosiene.co.uk/viewtopic.php?f=14&t=16425&p=126065 described here]. If you are writing a set of web pages, you can make your web suite very much easier to maintain by not putting every instruction into one script, you can use syntax like 'require' or 'include' to effectively bring in common code from other scripts. These other scripts might contain standard functions (like connecting to a database, reading from a database and calculating highest or lowest) or they might contain a standard navigation header that you want for all your web pages (with ability to identify which script is the current one, which CSS files to attach, and so on). So  a standard header (and footer) can make all your web pages look similar and there is only one place where you need to edit to change that look. But equally using a script a web page can look different depending on any data you choose (time of day, current season, whether it is raining, how hot it is) or it can display different content depending on particular values.
 


=== Learning More about PHP ===
=== Learning More about PHP ===
5,838

edits