PHP

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

PHP

(recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web dev and can be embedded into HTML. is a server-side scripting language. It is intended to help web developers build dynamic web sites quickly. PHP scripts are executed on the server, before the web page is displayed to the user (this is what we mean by "server-side").

PHP syntax

Creating a PHP file is similar to creating an HTML file. In fact, most PHP files are a mixture of PHP code and HTML. Creating a PHP File 1.To create a PHP file, simply do the following: 2.Create a new file in your favorite editor 3.Type some PHP code 4.Save the file with a .php extension The .php extension tells the web server that it needs to process this as a PHP file. If you accidentally save it with a .html extension the server won't process your PHP code and the browser will just output it all to the screen.

How PHP works?

The software works with the web server, which is the software that delivers web pages to the world. When you type a URL into your web browser's address bar, you're sending a message to the web server at that URL, asking it to send you an HTML file. The web server responds by sending the requested file. Your browser reads the HTML file and displays the web page. You also request a file from the web server when you click a link in a web page. In addition, the web server processes a file when you click a web page button that submits a form. This process is essentially the same when PHP is installed. You request a file, the web server happens to be running PHP, and it sends HTML back to the browser, thanks to the programming in PHP.

VS Code

Visual Studio Code

Variables

are used to store information to be referenced and manipulated in a computer program. They also provide a way of labeling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves. It is helpful to think of variables as containers that hold information. Their sole purpose is to label and store data in memory. This data can be then used throughout your program.

What PHP Can Do?

enables you to build large, complex, and dynamic websites. It can also increase your productivity enormously, both in development time and maintenance time. Using it, you can build websites that do things such as: Query a database Allow users to upload files Create/read files on the server (for example, the files that your users upload) Have a "member's area" (i.e. via a login page) Have a shopping cart Present a customized experience (for example, based on users' browsing history)

script or scripting language

is a programming language for a special run-time environment. It automates the execution of tasks; the tasks could alternatively be executed one-by-one by a human operator. are often interpreted (rather than compiled).

Xampp

is an abbreviation for cross-platform, Apache, MySQL, PHP and Perl

PHP is an embedded scripting language

when used in web pages. This means that PHP code is embedded in HTML code. You use HTML tags to enclose the PHP language that you embed in your HTML file — the same way that you would use other HTML tags. You create and edit web pages containing PHP the same way that you create and edit regular HTML pages. The PHP language statements are enclosed in PHP tags with the following form: <?php ?>

When you're naming a variable, keep the following rules in mind:

✦ Identifier: All variable names have a dollar sign ($) in front of them. This tells PHP that it is a variable name. ✦ Beginning of name: Variable names must begin with a letter or an underscore. They cannot begin with a number. ✦ Acceptable length: Variable names can be any length. ✦ Acceptable characters: Variable names can include letters, numbers, and underscores only. ✦ Case sensitivity: Uppercase and lowercase letters are not the same. For example, $firstname and $Firstname are not the same variable.

three parts involved in producing the web page:

✦ The PHP script: PHP statements that you write. ✦ The HTML source code: The source code for the web page that you see ✦ The web page: The web page that your users see. The web page results


Ensembles d'études connexes

Advanced CAD Final Exam Review - Chapters 1 thru 16

View Set

Content areas: Safety, Skills, and Cultural Awareness

View Set

Texas Portion of the Real Estate Exam

View Set