Introduction to PHP Practical 1 PDF
Document Details
Uploaded by ExpansiveElation8024
Suzan Jastaniah
Tags
Summary
This document is a lecture on the basics of PHP programming, including syntax, variables, data types, and output. It also contains a brief review of web technologies and how server-side technology works. The document is suitable for introductory courses on web development.
Full Transcript
INTRODUCTION TO PHP Lecture # 1 -practical Week # 2 Suzan Jastaniah INTRODUCTION TO PHP (TOPICS) 1. Basic file syntax 2. Printing echo() 3. Comments 4. Variables , Data types, Variables naming and Constants 5. Arrays, associative arrays and multidimensional arrays. WEB TECHNOLOGIES (REV...
INTRODUCTION TO PHP Lecture # 1 -practical Week # 2 Suzan Jastaniah INTRODUCTION TO PHP (TOPICS) 1. Basic file syntax 2. Printing echo() 3. Comments 4. Variables , Data types, Variables naming and Constants 5. Arrays, associative arrays and multidimensional arrays. WEB TECHNOLOGIES (REVIEW) Client-side scripting language Server-side scripting language (HTML) (PHP) Similarities 1. Embedded with XHTML 2. Activated after an event occurs Differences 1. Interpreted at client side 1. Interpreted at server side 2. Used in frontend development, 2. Used in backend development, which organizes the content of which interacts with databases to the website retrieve, store, and modify the information 3.. Interpreted by browser 3. Requires web server application (i.e. Apache, IIS) Examples: HTML, VBScript, Examples: ASP, PHP, CGI JavaScript HOW SERVER-SIDE TECHNOLOGY WORKS (REVIEW) Web Server Client Web server application Request Web page HTML Script Request PHP Translation INTRODUCTION TO PHP ….. WHAT IS PHP It stands for Hypertext Preprocessor It is an HTML embedded server-side scripting language which will perform a specific task after an event occurs. PHP can perform an array of tasks such as user authentication, form processing, database interaction….etc. PHP files can contain text, HTML, CSS, JavaScript, and PHP code It is different from programming languages which can stand alone and be compiled like Java and C. WHY USE PHP? PHP is a server-side scripting language PHP scripts are executed on the server and the result is returned to the browser as plain HTML PHP supports many databases (MySQL, Informix, Oracle, Sybase, etc.) PHP is open-source software PHP is written specifically for making dynamic and interactive Web pages. It can do certain tasks faster and easier than its alternatives PHP is free anddownload and use WHAT YOU WILL NEED PHP software Web Server Application (i.e. Apache, WAMP, IIS) MySQL database software PHP GETTING STARTED On windows, you can download and install WAMP. With one installation and you get an Apache webserver, database server and php. http://www.wampserver.com How to install and run the files: ) كيفية تثبيت193(wamp وتشغيل صفحةphp - YouTube On mac, you can download and install MAMP. http://www.mamp.info/en/index.html PHP Online : 1. https://www.programiz.com/php/online-compiler/ 2. https://onecompiler.com/php PHP SYNTAX A PHP script can be placed anywhere in the document. A PHP script starts with PHP files have extension (.php ) TESTING THE SCRIPT You can use to create pages using Notepad or Visual Studio Code Save your php files in the C:\wamp64\www Open the web browser then type: http://localhost/local/test.php PHP ECHO STATEMENTS echo is used to output data to the screen. echo has no return value echo can take multiple parameters echo statement can be used with or without parentheses: echo or echo(). PHP HELLO WORLD THIS program is extremely simple. All it does is display: Hello World using the PHP echo statement. Output PHP EXAMPLE.. It renders as HTML that looks like this: Output 1. 2. 3. 4. PHP Test 5. 6. 7. The following is created by PHP: 8.