Lecture Web technologies and programming – Lecture 23: Introduction to PHP (Part 2)

After studying this chapter you will be able to understand: Setting the environment, overview of PHP, constants and variables in PHP, operators in PHP, conditional statements in PHP, looping statements, arrays in PHP. | 1 CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr. Tehseen Riaz Abbasi 1 2 Setting the environment PHP overview What is a PHP File Open-source Platform independent What Can PHP Do? Why PHP? Basic PHP Syntax Writing and Executing PHP Code PHP constants Constants are Global PHP variables Local Global Static Type Determination PHP Strings PHP is a Loosely Typed Language 3 3 Department of Computer Science, CIIT Islamabad. Operators in PHP Conditional Statements in PHP Looping Statements Arrays in PHP 4 4 Department of Computer Science, CIIT Islamabad. 5 Operators are used to perform operations on variables and values. PHP divides the operators in the following groups: Arithmetic operators Assignment operators String operators Increment/Decrement operators Logical operators Comparison operators Equality Operators Array operators 6 Arithmetic Operators: The PHP arithmetic operators are used with numeric values to perform common arithmetical operations, such as addition, subtraction, multiplication etc. +, - ,*, /, %, ** 7 Assignment Operators: The PHP assignment operators are used with numeric values to write a value to a variable. The basic assignment operator in PHP is "=". It means that the left operand gets set to the value of the assignment expression on the right. = += ($a +=$b ), *= , /= .= ($a .= $b) 8 9 String Operators: PHP has two operators that are specially designed for strings. . , .= $a=“abcd”.”efgh”; $a=abcdefgh $a.=“ijk”; $a=abcdefghijk 10 String Operators: 11 First Variable Second Variable Concatenation Using .= 12 13 Adds $b in $a Concatenates $b with $a 14 15 Increment/decrement Operators: The PHP increment operators are used to increment a variable's value. The PHP decrement operators are used to decrement a variable's value. ++ , -- $b=$a++ $b=++$a 16 Increment/decrement Operators: 17 Variable Declared Incremented Before Display Incremented After Display Displaying Incremented Value 18 19 Logical Operators: The PHP logical operators are used to | 1 CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr. Tehseen Riaz Abbasi 1 2 Setting the environment PHP overview What is a PHP File Open-source Platform independent What Can PHP Do? Why PHP? Basic PHP Syntax Writing and Executing PHP Code PHP constants Constants are Global PHP variables Local Global Static Type Determination PHP Strings PHP is a Loosely Typed Language 3 3 Department of Computer Science, CIIT Islamabad. Operators in PHP Conditional Statements in PHP Looping Statements Arrays in PHP 4 4 Department of Computer Science, CIIT Islamabad. 5 Operators are used to perform operations on variables and values. PHP divides the operators in the following groups: Arithmetic operators Assignment operators String operators Increment/Decrement operators Logical operators Comparison operators Equality Operators Array operators 6 Arithmetic Operators: The PHP arithmetic operators are used with numeric values to perform common arithmetical operations, such as addition, subtraction, .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
272    23    1    01-12-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.