SlideShare a Scribd company logo
1 of 18
PHP BASIC
BEFORE WE GET STARTED
1. Using Windows 10 or Ubuntu 16.04.
2. Installed Git.
3. Installed Chrome Web Browser.
4. Installed VS Code.
5. Installed XAMPP for Windows PHP 7.0.
6. Checkout :
https://github.com/namnh06/aptech-php-
course
HOW THE WEBSITE WORKS ?
SET UP ENVIROMENT
1. Turn on Git Bash (on Windows).
2. Move to C:/xampp/htdocs/ by command line : cd /c/xampp/htdocs -> Enter.
3. Clone Repository by Git Hub, using this command line : git clone
https://github.com/namnh06/aptech-php-course.git -> Enter.
4. Using this repository to learn and get homework, exercise from there.
5. Create your repository with convention code : Aptech-php-*-your-name. E.G : Aptech-
php-12-nam-nh.
6. Push your repository to Git Hub and do your home work.
SYNTAX, ECHO, COMMENT
 PHP files have “.php” extension.
 PHP script always starts with <?php and end with ?>, in some case no need to close ?> in file
.php. The end of statement of code always need “;”.
 Comment starts with “//”, “#” or “/* */”.
 Output into HTML Dom by using “echo”, “print”,
“print_r” or “var_dump”.
 Can write HTML, CSS, Javascript inside “.php” file.
VARIABLE, CONSTANT
 Variable starts with “$” (dollar sign), no need to declare type
of variable.
 Variable name must start with a letter or underscore character
“_” and can not start with number.
 Variable name can only contain alpha-numeric characters and
underscores (A-z, 0-9 and _ ).
 Using “global”, “static” keyword to make variable “special”.
 Using function “define” to create a constant.
DATA TYPES
 String : a sequence of characters.
 Integer : non-decimal number between -2,147,483,648 and 2,147,483,647.
 Float : decimal number.
 Boolean : TRUE/FALSE.
 Array : stores multiple values.
 Object : stores data and information or properties and function.
 NULL : is NULL.
OPERATORS
 Arithmetic Operators
OPERATORS (cont. 1)
 Assignment Operators
OPERATORS (cont. 2)
 Comparison Operators
 Increment/Decrement Operators
OPERATORS (cont. 3)
 Logical Operators
 String Operators
OPERATORS (cont. 4)
 Array Operators
CONDITION STATMENTS
 If
 If … else
 If … else if … else
 Switch case
LOOPS
 While
 Do ... While
 Foreach
 For
FUNCTIONS
 A function name can start with a letter or underscore (not a number).
 Give the function a name that reflects what the function does!
 PHP has more than 1000 built-in functions.
SUPERGLOBALS
 Built-in variables that are always available in all scopes.
 Always accessible, regardless of scope, can access from any function or file.
 $GLOBALS
 $_SERVER
 $_REQUEST
 $_POST
 $_GET
 $_FILES
 $_ENV
 $_COOKIE
 $_SESSION
TIME TO PRACTICE.
EXERCISE
1. Write a PHP script to get the PHP version and configuration information.
2. Write a PHP script to display the following strings. E.g : ‘My name is Nam’.
3. $var = 'PHP Tutorial'. Put this variable into the title section, h3 tag and as an anchor text
within an HTML document.
4. Do the operator : 10/5 and print the result.
5. Create a variable and use it into an string. E.g : ‘hello ’ + $var + ‘ world’.

More Related Content

Similar to PHP-Basic

Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Muhamad Al Imran
 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Muhamad Al Imran
 
Php tutorial from_beginner_to_master
Php tutorial from_beginner_to_masterPhp tutorial from_beginner_to_master
Php tutorial from_beginner_to_master
PrinceGuru MS
 
1336333055 php tutorial_from_beginner_to_master
1336333055 php tutorial_from_beginner_to_master1336333055 php tutorial_from_beginner_to_master
1336333055 php tutorial_from_beginner_to_master
jeeva indra
 

Similar to PHP-Basic (20)

Php training in chandigarh
Php  training in chandigarhPhp  training in chandigarh
Php training in chandigarh
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Basics PHP
Basics PHPBasics PHP
Basics PHP
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Php i basic chapter 3
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3
 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
 
Php tutorial from_beginner_to_master
Php tutorial from_beginner_to_masterPhp tutorial from_beginner_to_master
Php tutorial from_beginner_to_master
 
1336333055 php tutorial_from_beginner_to_master
1336333055 php tutorial_from_beginner_to_master1336333055 php tutorial_from_beginner_to_master
1336333055 php tutorial_from_beginner_to_master
 
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
 
Day1
Day1Day1
Day1
 
Dive into exploit development
Dive into exploit developmentDive into exploit development
Dive into exploit development
 
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
 
PHP - Introduction to PHP - Mazenet Solution
PHP - Introduction to PHP - Mazenet SolutionPHP - Introduction to PHP - Mazenet Solution
PHP - Introduction to PHP - Mazenet Solution
 
New Stuff In Php 5.3
New Stuff In Php 5.3New Stuff In Php 5.3
New Stuff In Php 5.3
 
Php by shivitomer
Php by shivitomerPhp by shivitomer
Php by shivitomer
 
Php
PhpPhp
Php
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course Deck
 
PHP
PHPPHP
PHP
 
Php
PhpPhp
Php
 

More from QuyVo27 (14)

Tong quan benh xuong khop
Tong quan benh xuong khopTong quan benh xuong khop
Tong quan benh xuong khop
 
Medical image procesing
Medical image procesingMedical image procesing
Medical image procesing
 
b6-190213084710.pdf
b6-190213084710.pdfb6-190213084710.pdf
b6-190213084710.pdf
 
b5-viewproc-190213084706.pdf
b5-viewproc-190213084706.pdfb5-viewproc-190213084706.pdf
b5-viewproc-190213084706.pdf
 
b34-dml-sql-190213084703.pdf
b34-dml-sql-190213084703.pdfb34-dml-sql-190213084703.pdf
b34-dml-sql-190213084703.pdf
 
b2-ddl-create-190213085738.pdf
b2-ddl-create-190213085738.pdfb2-ddl-create-190213085738.pdf
b2-ddl-create-190213085738.pdf
 
b2-ddl-create-190213084659.pdf
b2-ddl-create-190213084659.pdfb2-ddl-create-190213084659.pdf
b2-ddl-create-190213084659.pdf
 
b1-gioithieu-190213084421.pdf
b1-gioithieu-190213084421.pdfb1-gioithieu-190213084421.pdf
b1-gioithieu-190213084421.pdf
 
SQL Server 2014 – Features Drilldown.pptx
SQL Server 2014 – Features Drilldown.pptxSQL Server 2014 – Features Drilldown.pptx
SQL Server 2014 – Features Drilldown.pptx
 
SQL Server 2019 Modern Data Platform.pptx
SQL Server 2019 Modern Data Platform.pptxSQL Server 2019 Modern Data Platform.pptx
SQL Server 2019 Modern Data Platform.pptx
 
SQL_SERVER_BASIC_1_Training.pptx
SQL_SERVER_BASIC_1_Training.pptxSQL_SERVER_BASIC_1_Training.pptx
SQL_SERVER_BASIC_1_Training.pptx
 
SQL Server 2016 - Always On.pptx
SQL Server 2016 - Always On.pptxSQL Server 2016 - Always On.pptx
SQL Server 2016 - Always On.pptx
 
Querying_with_T-SQL_-_01.pptx
Querying_with_T-SQL_-_01.pptxQuerying_with_T-SQL_-_01.pptx
Querying_with_T-SQL_-_01.pptx
 
MS SQL Server.ppt
MS SQL Server.pptMS SQL Server.ppt
MS SQL Server.ppt
 

Recently uploaded

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Recently uploaded (20)

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 

PHP-Basic

  • 2. BEFORE WE GET STARTED 1. Using Windows 10 or Ubuntu 16.04. 2. Installed Git. 3. Installed Chrome Web Browser. 4. Installed VS Code. 5. Installed XAMPP for Windows PHP 7.0. 6. Checkout : https://github.com/namnh06/aptech-php- course
  • 3. HOW THE WEBSITE WORKS ?
  • 4. SET UP ENVIROMENT 1. Turn on Git Bash (on Windows). 2. Move to C:/xampp/htdocs/ by command line : cd /c/xampp/htdocs -> Enter. 3. Clone Repository by Git Hub, using this command line : git clone https://github.com/namnh06/aptech-php-course.git -> Enter. 4. Using this repository to learn and get homework, exercise from there. 5. Create your repository with convention code : Aptech-php-*-your-name. E.G : Aptech- php-12-nam-nh. 6. Push your repository to Git Hub and do your home work.
  • 5. SYNTAX, ECHO, COMMENT  PHP files have “.php” extension.  PHP script always starts with <?php and end with ?>, in some case no need to close ?> in file .php. The end of statement of code always need “;”.  Comment starts with “//”, “#” or “/* */”.  Output into HTML Dom by using “echo”, “print”, “print_r” or “var_dump”.  Can write HTML, CSS, Javascript inside “.php” file.
  • 6. VARIABLE, CONSTANT  Variable starts with “$” (dollar sign), no need to declare type of variable.  Variable name must start with a letter or underscore character “_” and can not start with number.  Variable name can only contain alpha-numeric characters and underscores (A-z, 0-9 and _ ).  Using “global”, “static” keyword to make variable “special”.  Using function “define” to create a constant.
  • 7. DATA TYPES  String : a sequence of characters.  Integer : non-decimal number between -2,147,483,648 and 2,147,483,647.  Float : decimal number.  Boolean : TRUE/FALSE.  Array : stores multiple values.  Object : stores data and information or properties and function.  NULL : is NULL.
  • 9. OPERATORS (cont. 1)  Assignment Operators
  • 10. OPERATORS (cont. 2)  Comparison Operators  Increment/Decrement Operators
  • 11. OPERATORS (cont. 3)  Logical Operators  String Operators
  • 12. OPERATORS (cont. 4)  Array Operators
  • 13. CONDITION STATMENTS  If  If … else  If … else if … else  Switch case
  • 14. LOOPS  While  Do ... While  Foreach  For
  • 15. FUNCTIONS  A function name can start with a letter or underscore (not a number).  Give the function a name that reflects what the function does!  PHP has more than 1000 built-in functions.
  • 16. SUPERGLOBALS  Built-in variables that are always available in all scopes.  Always accessible, regardless of scope, can access from any function or file.  $GLOBALS  $_SERVER  $_REQUEST  $_POST  $_GET  $_FILES  $_ENV  $_COOKIE  $_SESSION
  • 18. EXERCISE 1. Write a PHP script to get the PHP version and configuration information. 2. Write a PHP script to display the following strings. E.g : ‘My name is Nam’. 3. $var = 'PHP Tutorial'. Put this variable into the title section, h3 tag and as an anchor text within an HTML document. 4. Do the operator : 10/5 and print the result. 5. Create a variable and use it into an string. E.g : ‘hello ’ + $var + ‘ world’.