SlideShare a Scribd company logo
1 of 19
Php training in chandigarh
CBitss Technologies, SCO:23-24-25, Level 3rd, Sector 34A,
Chandigarh, , 160022 Contact : 9914641983
PHP History
PHP 3
PHP 3.0 was the first version that closely resembles PHP as it exists today. Finding PHP/FI 2.0 still inefficient and lacking
features they needed to power an eCommerce application they were developing for a university project, Andi Gutmans
and Zeev Suraski of Tel Aviv, Israel, began yet another complete rewrite of the underlying parser in 1997.
PHP 4
By the winter of 1998, shortly after PHP 3.0 was officially released, Andi Gutmans and Zeev Suraski had begun working
on a rewrite of PHP's core. The design goals were to improve performance of complex applications, and improve the
modularity of PHP's code base. Such applications were made possible by PHP 3.0's new features and support for a wide
variety of third party databases and APIs, but PHP 3.0 was not designed to handle such complex applications efficiently.
PHP 5
PHP 5 was released in July 2004 after long development and several pre-releases. It is mainly driven by its core, the Zend
Engine 2.0 with a new object model and dozens of other new features.
Installation & configuration
1. Step 1: Install MySQL. Install the MySQL database server on your PC. ...
2. Step 2: Install Apache. Install the Apache web server on your PC. ...
3. Step 3: Install PHP. Now install the PHP scripting language on your PC. ...
4. Step 4: Configure Apache and PHP. ...
5. Step 5: Test your install. ...
6. Step 6: Install Git. ...
7. Step 7: Install Moodle.
PHP basic syntax
A PHP script can be placed anywhere in the
document.
A PHP script starts with <?php and ends with ?>:
<?php
// PHP code goes here
?>
PHP Date Php Variables
The PHP date() function convert a
timestamp to a more readable date
and time. The computer stores
dates and times in a format called
UNIX Timestamp, which measures
time as a number of seconds since
the beginning of the Unix epoch
(midnight Greenwich Mean Time
on January 1, 1970 i.e. January 1,
1970 00:00:00 GMT ).
A variable can have a short name (like x and y)
or a more descriptive name (age, carname,
total_volume).
Rules for PHP variables:
● A variable starts with the $ sign, followed
by the name of the variable
● A variable name must start with a letter
or the underscore character
● A variable name cannot start with a
number
● A variable name can only contain alpha-
numeric characters and underscores (A-
z, 0-9, and _ )
● Variable names are case-sensitive ($age
and $AGE are two different variables)
Strings in php
A string is a sequence of characters, like "Hello world!".
Get The Length of a String
The PHP strlen() function returns the length of a string.
The example below returns the length of the string "Hello world!":
<?php
echo strlen("Hello world!"); // outputs 12
?>
Understanding Operators in php
Operators are used to perform operations on variables and values.
PHP divides the operators in the following groups:
● Arithmetic operators
● Assignment operators
● Comparison operators
● Increment/Decrement operators
● Logical operators
● String operators
● Array operators
If…Else
Very often when you write code, you want to perform different actions for different
conditions. You can use conditional statements in your code to do this.
In PHP we have the following conditional statements:
● if statement - executes some code if one condition is true
● if...else statement - executes some code if a condition is true and another
code if that condition is false
● if...elseif....else statement - executes different codes for more than two
conditions
● switch statement - selects one of many blocks of code to be executed
The PHP switch Statement
Use the switch statement to select one of many blocks of code to be executed.
Syntax
switch (n) {
case label1:
code to be executed if n=label1;
break;
case label2:
code to be executed if n=label2;
break;
PHP Array : An array is a special variable, which can hold more than one value at a time.
If you have a list of items (a list of car names, for example), storing the cars in single variables
could look like this:
$cars1 = "Volvo";
$cars2 = "BMW";
$cars3 = "Toyota";
However, what if you want to loop through the cars and find a specific one? And what if you
had not 3 cars, but 300?
The solution is to create an array!
An array can hold many values under a single name, and you can access the values by referring
to an index number.
PHP Sorting Arrays
PHP - Sort Functions For Arrays
In this chapter, we will go through the following PHP array sort functions:
● sort() - sort arrays in ascending order
● rsort() - sort arrays in descending order
● asort() - sort associative arrays in ascending order, according to the value
● ksort() - sort associative arrays in ascending order, according to the key
● arsort() - sort associative arrays in descending order, according to the value
● krsort() - sort associative arrays in descending order, according to the key
While & Do while loops
Often when you write code, you want the same block of code to run over and over
again in a row. Instead of adding several almost equal code-lines in a script, we
can use loops to perform a task like this.
In PHP, we have the following looping statements:
● while - loops through a block of code as long as the specified condition is true
● do...while - loops through a block of code once, and then repeats the loop as
long as the specified condition is true
● for - loops through a block of code a specified number of times
● foreach - loops through a block of code for each element in an array
For Loops
The for loop is used when you know in advance how many times the script
should run.
Syntax
for (init counter; test counter; increment counter) {
code to be executed;
}
Functions
Besides the built-in PHP functions, we can create our own functions.
A function is a block of statements that can be used repeatedly in a
program.
A function will not execute immediately when a page loads.
A function will be executed by a call to the function.
The GET Method
The GET method sends the encoded user information appended to the page request. The page
and the encoded information are separated by the ? character.
http://www.test.com/index.htm?name1=value1&name2=value2
● The GET method produces a long string that appears in your server logs, in the browser's
Location: box.
● The GET method is restricted to send upto 1024 characters only.
● Never use GET method if you have password or other sensitive information to be sent to
the server.
● GET can't be used to send binary data, like images or word documents, to the server.
● The data sent by GET method can be accessed using QUERY_STRING environment
variable.
● The PHP provides $_GET associative array to access all the sent information using GET
method.
The POST Method
The POST method transfers information via HTTP headers. The
information is encoded as described in case of GET method and put into a
header called QUERY_STRING.
● The POST method does not have any restriction on data size to be
sent.
● The POST method can be used to send ASCII as well as binary data.
● The data sent by POST method goes through HTTP header so security
depends on HTTP protocol. By using Secure HTTP you can make sure
that your information is secure.
● The PHP provides $_POST associative array to access all the sent
information using POST method.
Contact Us
OFFICE : SCO 23-24-25, LEVEL-3,
near passport office,
Sector 34A, Chandigarh
PHONE : 9988741983, 9914641983
Visit : http://cbitss.com/php-training-in-chandigarh.html
THANK
YOU

More Related Content

What's hot

Ekon bestof rtl_delphi
Ekon bestof rtl_delphiEkon bestof rtl_delphi
Ekon bestof rtl_delphiMax Kleiner
 
File Handling in C Programming
File Handling in C ProgrammingFile Handling in C Programming
File Handling in C ProgrammingRavindraSalunke3
 
Presentation on C++ programming
Presentation on C++ programming Presentation on C++ programming
Presentation on C++ programming AditiTibile
 
Specialized Compiler for Hash Cracking
Specialized Compiler for Hash CrackingSpecialized Compiler for Hash Cracking
Specialized Compiler for Hash CrackingPositive Hack Days
 
web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh MalothBhavsingh Maloth
 
Learn python – for beginners
Learn python – for beginnersLearn python – for beginners
Learn python – for beginnersRajKumar Rampelli
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go languageTzar Umang
 
Writing and using php streams and sockets
Writing and using php streams and socketsWriting and using php streams and sockets
Writing and using php streams and socketsElizabeth Smith
 
Generating parsers using Ragel and Lemon
Generating parsers using Ragel and LemonGenerating parsers using Ragel and Lemon
Generating parsers using Ragel and LemonTristan Penman
 
What is Python Lambda Function? Python Tutorial | Edureka
What is Python Lambda Function? Python Tutorial | EdurekaWhat is Python Lambda Function? Python Tutorial | Edureka
What is Python Lambda Function? Python Tutorial | EdurekaEdureka!
 
Insecure coding in C (and C++)
Insecure coding in C (and C++)Insecure coding in C (and C++)
Insecure coding in C (and C++)Olve Maudal
 
Php intro by sami kz
Php intro by sami kzPhp intro by sami kz
Php intro by sami kzsami2244
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programmingSrinivas Narasegouda
 
Switch case and looping kim
Switch case and looping kimSwitch case and looping kim
Switch case and looping kimkimberly_Bm10203
 
Python introduction towards data science
Python introduction towards data sciencePython introduction towards data science
Python introduction towards data sciencedeepak teja
 

What's hot (20)

php questions
php questions php questions
php questions
 
PHP Reviewer
PHP ReviewerPHP Reviewer
PHP Reviewer
 
Ekon bestof rtl_delphi
Ekon bestof rtl_delphiEkon bestof rtl_delphi
Ekon bestof rtl_delphi
 
First session quiz
First session quizFirst session quiz
First session quiz
 
File Handling in C Programming
File Handling in C ProgrammingFile Handling in C Programming
File Handling in C Programming
 
Presentation on C++ programming
Presentation on C++ programming Presentation on C++ programming
Presentation on C++ programming
 
Specialized Compiler for Hash Cracking
Specialized Compiler for Hash CrackingSpecialized Compiler for Hash Cracking
Specialized Compiler for Hash Cracking
 
web programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Malothweb programming UNIT VIII python by Bhavsingh Maloth
web programming UNIT VIII python by Bhavsingh Maloth
 
Learn python – for beginners
Learn python – for beginnersLearn python – for beginners
Learn python – for beginners
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go language
 
Writing and using php streams and sockets
Writing and using php streams and socketsWriting and using php streams and sockets
Writing and using php streams and sockets
 
Python programming
Python programmingPython programming
Python programming
 
Generating parsers using Ragel and Lemon
Generating parsers using Ragel and LemonGenerating parsers using Ragel and Lemon
Generating parsers using Ragel and Lemon
 
What is Python Lambda Function? Python Tutorial | Edureka
What is Python Lambda Function? Python Tutorial | EdurekaWhat is Python Lambda Function? Python Tutorial | Edureka
What is Python Lambda Function? Python Tutorial | Edureka
 
Insecure coding in C (and C++)
Insecure coding in C (and C++)Insecure coding in C (and C++)
Insecure coding in C (and C++)
 
Php intro by sami kz
Php intro by sami kzPhp intro by sami kz
Php intro by sami kz
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
 
Switch case and looping jam
Switch case and looping jamSwitch case and looping jam
Switch case and looping jam
 
Switch case and looping kim
Switch case and looping kimSwitch case and looping kim
Switch case and looping kim
 
Python introduction towards data science
Python introduction towards data sciencePython introduction towards data science
Python introduction towards data science
 

Similar to Php training in chandigarh (20)

PHP Comprehensive Overview
PHP Comprehensive OverviewPHP Comprehensive Overview
PHP Comprehensive Overview
 
Materi Dasar PHP
Materi Dasar PHPMateri Dasar PHP
Materi Dasar PHP
 
Php tutorial(w3schools)
Php tutorial(w3schools)Php tutorial(w3schools)
Php tutorial(w3schools)
 
Php tutorialw3schools
Php tutorialw3schoolsPhp tutorialw3schools
Php tutorialw3schools
 
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
 
Php
PhpPhp
Php
 
Basic of PHP
Basic of PHPBasic of PHP
Basic of PHP
 
Php Basics
Php BasicsPhp Basics
Php Basics
 
Hsc IT 5. Server-Side Scripting (PHP).pdf
Hsc IT 5. Server-Side Scripting (PHP).pdfHsc IT 5. Server-Side Scripting (PHP).pdf
Hsc IT 5. Server-Side Scripting (PHP).pdf
 
PHP - Introduction to PHP - Mazenet Solution
PHP - Introduction to PHP - Mazenet SolutionPHP - Introduction to PHP - Mazenet Solution
PHP - Introduction to PHP - Mazenet Solution
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
php
phpphp
php
 
PHP - Web Development
PHP - Web DevelopmentPHP - Web Development
PHP - Web Development
 
Php
PhpPhp
Php
 
Php tutorial from_beginner_to_master
Php tutorial from_beginner_to_masterPhp tutorial from_beginner_to_master
Php tutorial from_beginner_to_master
 
Chap 4 PHP.pdf
Chap 4 PHP.pdfChap 4 PHP.pdf
Chap 4 PHP.pdf
 
php41.ppt
php41.pptphp41.ppt
php41.ppt
 
PHP InterLevel.ppt
PHP InterLevel.pptPHP InterLevel.ppt
PHP InterLevel.ppt
 
php-I-slides.ppt
php-I-slides.pptphp-I-slides.ppt
php-I-slides.ppt
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 

More from CBitss Technologies

Introduction and history of tally accounting software
Introduction and history of tally accounting softwareIntroduction and history of tally accounting software
Introduction and history of tally accounting softwareCBitss Technologies
 
Ielts coaching in chandigarh english pro
Ielts coaching in chandigarh   english proIelts coaching in chandigarh   english pro
Ielts coaching in chandigarh english proCBitss Technologies
 
Glimpse of previous you tube events c-bitss technologies
Glimpse of previous you tube events   c-bitss technologies  Glimpse of previous you tube events   c-bitss technologies
Glimpse of previous you tube events c-bitss technologies CBitss Technologies
 
Industrial training in chandigarh
Industrial training in chandigarhIndustrial training in chandigarh
Industrial training in chandigarhCBitss Technologies
 

More from CBitss Technologies (12)

Career opportunities in python
Career opportunities in python Career opportunities in python
Career opportunities in python
 
Web Designing Trends 2019
Web Designing Trends 2019 Web Designing Trends 2019
Web Designing Trends 2019
 
Introduction and history of tally accounting software
Introduction and history of tally accounting softwareIntroduction and history of tally accounting software
Introduction and history of tally accounting software
 
Ielts coaching in chandigarh english pro
Ielts coaching in chandigarh   english proIelts coaching in chandigarh   english pro
Ielts coaching in chandigarh english pro
 
Glimpse of previous you tube events c-bitss technologies
Glimpse of previous you tube events   c-bitss technologies  Glimpse of previous you tube events   c-bitss technologies
Glimpse of previous you tube events c-bitss technologies
 
Industrial training in chandigarh
Industrial training in chandigarhIndustrial training in chandigarh
Industrial training in chandigarh
 
Android training in chandigarh
Android training in chandigarhAndroid training in chandigarh
Android training in chandigarh
 
Php training in chandigarh
Php training in chandigarhPhp training in chandigarh
Php training in chandigarh
 
Android training in chandigarh
Android training in chandigarhAndroid training in chandigarh
Android training in chandigarh
 
Android Training in Chandigarh
Android Training in ChandigarhAndroid Training in Chandigarh
Android Training in Chandigarh
 
Linux training in chandigarh
Linux training in chandigarhLinux training in chandigarh
Linux training in chandigarh
 
Php training in chandigarh
Php training in chandigarhPhp training in chandigarh
Php training in chandigarh
 

Recently uploaded

9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 

Recently uploaded (20)

9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 

Php training in chandigarh

  • 1. Php training in chandigarh CBitss Technologies, SCO:23-24-25, Level 3rd, Sector 34A, Chandigarh, , 160022 Contact : 9914641983
  • 2.
  • 3. PHP History PHP 3 PHP 3.0 was the first version that closely resembles PHP as it exists today. Finding PHP/FI 2.0 still inefficient and lacking features they needed to power an eCommerce application they were developing for a university project, Andi Gutmans and Zeev Suraski of Tel Aviv, Israel, began yet another complete rewrite of the underlying parser in 1997. PHP 4 By the winter of 1998, shortly after PHP 3.0 was officially released, Andi Gutmans and Zeev Suraski had begun working on a rewrite of PHP's core. The design goals were to improve performance of complex applications, and improve the modularity of PHP's code base. Such applications were made possible by PHP 3.0's new features and support for a wide variety of third party databases and APIs, but PHP 3.0 was not designed to handle such complex applications efficiently. PHP 5 PHP 5 was released in July 2004 after long development and several pre-releases. It is mainly driven by its core, the Zend Engine 2.0 with a new object model and dozens of other new features.
  • 4. Installation & configuration 1. Step 1: Install MySQL. Install the MySQL database server on your PC. ... 2. Step 2: Install Apache. Install the Apache web server on your PC. ... 3. Step 3: Install PHP. Now install the PHP scripting language on your PC. ... 4. Step 4: Configure Apache and PHP. ... 5. Step 5: Test your install. ... 6. Step 6: Install Git. ... 7. Step 7: Install Moodle.
  • 5. PHP basic syntax A PHP script can be placed anywhere in the document. A PHP script starts with <?php and ends with ?>: <?php // PHP code goes here ?>
  • 6. PHP Date Php Variables The PHP date() function convert a timestamp to a more readable date and time. The computer stores dates and times in a format called UNIX Timestamp, which measures time as a number of seconds since the beginning of the Unix epoch (midnight Greenwich Mean Time on January 1, 1970 i.e. January 1, 1970 00:00:00 GMT ). A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume). Rules for PHP variables: ● A variable starts with the $ sign, followed by the name of the variable ● A variable name must start with a letter or the underscore character ● A variable name cannot start with a number ● A variable name can only contain alpha- numeric characters and underscores (A- z, 0-9, and _ ) ● Variable names are case-sensitive ($age and $AGE are two different variables)
  • 7. Strings in php A string is a sequence of characters, like "Hello world!". Get The Length of a String The PHP strlen() function returns the length of a string. The example below returns the length of the string "Hello world!": <?php echo strlen("Hello world!"); // outputs 12 ?>
  • 8. Understanding Operators in php Operators are used to perform operations on variables and values. PHP divides the operators in the following groups: ● Arithmetic operators ● Assignment operators ● Comparison operators ● Increment/Decrement operators ● Logical operators ● String operators ● Array operators
  • 9. If…Else Very often when you write code, you want to perform different actions for different conditions. You can use conditional statements in your code to do this. In PHP we have the following conditional statements: ● if statement - executes some code if one condition is true ● if...else statement - executes some code if a condition is true and another code if that condition is false ● if...elseif....else statement - executes different codes for more than two conditions ● switch statement - selects one of many blocks of code to be executed
  • 10. The PHP switch Statement Use the switch statement to select one of many blocks of code to be executed. Syntax switch (n) { case label1: code to be executed if n=label1; break; case label2: code to be executed if n=label2; break;
  • 11. PHP Array : An array is a special variable, which can hold more than one value at a time. If you have a list of items (a list of car names, for example), storing the cars in single variables could look like this: $cars1 = "Volvo"; $cars2 = "BMW"; $cars3 = "Toyota"; However, what if you want to loop through the cars and find a specific one? And what if you had not 3 cars, but 300? The solution is to create an array! An array can hold many values under a single name, and you can access the values by referring to an index number.
  • 12. PHP Sorting Arrays PHP - Sort Functions For Arrays In this chapter, we will go through the following PHP array sort functions: ● sort() - sort arrays in ascending order ● rsort() - sort arrays in descending order ● asort() - sort associative arrays in ascending order, according to the value ● ksort() - sort associative arrays in ascending order, according to the key ● arsort() - sort associative arrays in descending order, according to the value ● krsort() - sort associative arrays in descending order, according to the key
  • 13. While & Do while loops Often when you write code, you want the same block of code to run over and over again in a row. Instead of adding several almost equal code-lines in a script, we can use loops to perform a task like this. In PHP, we have the following looping statements: ● while - loops through a block of code as long as the specified condition is true ● do...while - loops through a block of code once, and then repeats the loop as long as the specified condition is true ● for - loops through a block of code a specified number of times ● foreach - loops through a block of code for each element in an array
  • 14. For Loops The for loop is used when you know in advance how many times the script should run. Syntax for (init counter; test counter; increment counter) { code to be executed; }
  • 15. Functions Besides the built-in PHP functions, we can create our own functions. A function is a block of statements that can be used repeatedly in a program. A function will not execute immediately when a page loads. A function will be executed by a call to the function.
  • 16. The GET Method The GET method sends the encoded user information appended to the page request. The page and the encoded information are separated by the ? character. http://www.test.com/index.htm?name1=value1&name2=value2 ● The GET method produces a long string that appears in your server logs, in the browser's Location: box. ● The GET method is restricted to send upto 1024 characters only. ● Never use GET method if you have password or other sensitive information to be sent to the server. ● GET can't be used to send binary data, like images or word documents, to the server. ● The data sent by GET method can be accessed using QUERY_STRING environment variable. ● The PHP provides $_GET associative array to access all the sent information using GET method.
  • 17. The POST Method The POST method transfers information via HTTP headers. The information is encoded as described in case of GET method and put into a header called QUERY_STRING. ● The POST method does not have any restriction on data size to be sent. ● The POST method can be used to send ASCII as well as binary data. ● The data sent by POST method goes through HTTP header so security depends on HTTP protocol. By using Secure HTTP you can make sure that your information is secure. ● The PHP provides $_POST associative array to access all the sent information using POST method.
  • 18. Contact Us OFFICE : SCO 23-24-25, LEVEL-3, near passport office, Sector 34A, Chandigarh PHONE : 9988741983, 9914641983 Visit : http://cbitss.com/php-training-in-chandigarh.html