SlideShare una empresa de Scribd logo
1 de 26
PHP ,[object Object],[object Object],[object Object]
PHP P HP:  H ypertext  P reprocessor PHP: Hypertext Preprocessor PHP: Hypertext Preprocessor PHP: Hypertext Preprocessor PHP: ... Like GNU.
Its Easy – but Hard ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
LAMP Linux/Apache/MySQL/PHP
Hello World! ,[object Object],[object Object],[object Object],[object Object],[object Object]
Variables $ Prefix for variables $name =  'ILUG' ; // String $year =  2008 ; // Number $is_php_good =  true ; // Boolean // is a comment – as is /* to */ - PHP follows the C Syntax
Arrays/Hashes $arr = array(“Indian”, “Linux”, “User”, “Group”); $arr[1] = 'Libre'; print $arr[1]; $details = array( “abbr” => “ILUG”, “full” => “Indian Libre User Group” ); print $details['full'];
Operators ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Control Flow: if If if($name == 'Binny') { print “Hi, Binny”; } elseif($name == 'Sameer') { print “Hello Sameer”; } else { print “Hello everybody”; }
For/Foreach For $languages = array('PHP', 'Ruby', 'JavaScript', 'Python', 'Perl', 'Tcl'); for($i =0; $i < count($languages); $i++) { print $i+1 . “) “ . $languages[$i]; } Foreach foreach($languages as $lang) { print $lang; }
While Loop $i = 1; While($i < 10) { print $i; $i++; }
Functions function hello($name) { print “Hello, $name.”; } hello(“World”);
OOPs and PHP ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Class class Movie { public $name; function __construct($movie_name) { $this->name = $movie_name; } function show() { print $this->name; } } $film = new Movie(“City of God”); $film->show();
Getting Help PHP Manual(CHM) Install KCHM to view it.
Functions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Database ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Connection mysql_connect('localhost', 'root', 'password'); mysql_select_db('database_name'); Use a database abstraction layer. $db = new Sql(“localhost”, 'root', 'password', 'database_name');
Executing Queries  $sql_handle = mysql_query(“SELECT id,name FROM users WHERE status='1'”)  or die(mysql_error()); $result = mysql_fetch_assoc($sql_handle); print $result['name'];
Fetching Result while($result = mysql_fetch_assoc($sql_handle)) { print $result['name']; } Use Database Abstraction layer!
PHP and the Web Embedding PHP... <strong><?php print hello($name) ?></strong>
Form Submission <form action=”action.php” method=”post”> Age: <input type=”text” name=”age” /> <input type=”submit” name=”action” value=”Save” /> </form>
action.php if($_POST['action'] == 'Save') { print $_POST['age']; }
Frameworks ,[object Object],[object Object],[object Object],[object Object],[object Object]
Free Software ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Credits Getting Help:  http://www.flickr.com/photos/doctorow/2496308570/ MySql:  http://www.flickr.com/photos/johnniewalker/359440369/ Framework Image :  http://www.sxc.hu/photo/916787 Free Software:  http://www.flickr.com/photos/marcomolinari_it/2474783234/

Más contenido relacionado

La actualidad más candente (20)

Php mysql
Php mysqlPhp mysql
Php mysql
 
PHP Basics and Demo HackU
PHP Basics and Demo HackUPHP Basics and Demo HackU
PHP Basics and Demo HackU
 
Sa
SaSa
Sa
 
HackU PHP and Node.js
HackU PHP and Node.jsHackU PHP and Node.js
HackU PHP and Node.js
 
PHP - Introduction to PHP - Mazenet Solution
PHP - Introduction to PHP - Mazenet SolutionPHP - Introduction to PHP - Mazenet Solution
PHP - Introduction to PHP - Mazenet Solution
 
PHP - Introduction to PHP
PHP -  Introduction to PHPPHP -  Introduction to PHP
PHP - Introduction to PHP
 
Php Lecture Notes
Php Lecture NotesPhp Lecture Notes
Php Lecture Notes
 
PHP Workshop Notes
PHP Workshop NotesPHP Workshop Notes
PHP Workshop Notes
 
GettingStartedWithPHP
GettingStartedWithPHPGettingStartedWithPHP
GettingStartedWithPHP
 
PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDESPHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
 
PHP
PHPPHP
PHP
 
Intro to php
Intro to phpIntro to php
Intro to php
 
Introduction to php basics
Introduction to php   basicsIntroduction to php   basics
Introduction to php basics
 
Intro to PHP
Intro to PHPIntro to PHP
Intro to PHP
 
Class 6 - PHP Web Programming
Class 6 - PHP Web ProgrammingClass 6 - PHP Web Programming
Class 6 - PHP Web Programming
 
Hardcore PHP
Hardcore PHPHardcore PHP
Hardcore PHP
 
Php tutorial(w3schools)
Php tutorial(w3schools)Php tutorial(w3schools)
Php tutorial(w3schools)
 
PHP5.5 is Here
PHP5.5 is HerePHP5.5 is Here
PHP5.5 is Here
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
Php with my sql
Php with my sqlPhp with my sql
Php with my sql
 

Destacado

[Biblioteca De San Vicente + Biblioteca Central De La Ua]
[Biblioteca De San Vicente + Biblioteca Central De La Ua][Biblioteca De San Vicente + Biblioteca Central De La Ua]
[Biblioteca De San Vicente + Biblioteca Central De La Ua]nachocompany
 
Development: What They Don't Teach You in College
Development: What They Don't Teach You in CollegeDevelopment: What They Don't Teach You in College
Development: What They Don't Teach You in CollegeBinny V A
 
Introduction to PHP OOP
Introduction to PHP OOPIntroduction to PHP OOP
Introduction to PHP OOPfakhrul hasan
 
Oops concepts in php
Oops concepts in phpOops concepts in php
Oops concepts in phpCPD INDIA
 

Destacado (7)

[Biblioteca De San Vicente + Biblioteca Central De La Ua]
[Biblioteca De San Vicente + Biblioteca Central De La Ua][Biblioteca De San Vicente + Biblioteca Central De La Ua]
[Biblioteca De San Vicente + Biblioteca Central De La Ua]
 
Php By Virat
Php By ViratPhp By Virat
Php By Virat
 
Development: What They Don't Teach You in College
Development: What They Don't Teach You in CollegeDevelopment: What They Don't Teach You in College
Development: What They Don't Teach You in College
 
OOPS Characteristics (With Examples in PHP)
OOPS Characteristics (With Examples in PHP)OOPS Characteristics (With Examples in PHP)
OOPS Characteristics (With Examples in PHP)
 
Introduction to PHP OOP
Introduction to PHP OOPIntroduction to PHP OOP
Introduction to PHP OOP
 
Oops concepts in php
Oops concepts in phpOops concepts in php
Oops concepts in php
 
PHP MVC
PHP MVCPHP MVC
PHP MVC
 

Similar a PHP: The easiest language to learn.

Similar a PHP: The easiest language to learn. (20)

Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
 
The new features of PHP 7
The new features of PHP 7The new features of PHP 7
The new features of PHP 7
 
Starting Out With PHP
Starting Out With PHPStarting Out With PHP
Starting Out With PHP
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
My cool new Slideshow!
My cool new Slideshow!My cool new Slideshow!
My cool new Slideshow!
 
slidesharenew1
slidesharenew1slidesharenew1
slidesharenew1
 
Php tutorial
Php tutorialPhp tutorial
Php tutorial
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Php Tutorial | Introduction Demo | Basics
 Php Tutorial | Introduction Demo | Basics Php Tutorial | Introduction Demo | Basics
Php Tutorial | Introduction Demo | Basics
 
Learning of Php and My SQL Tutorial | For Beginners
Learning of Php and My SQL Tutorial | For BeginnersLearning of Php and My SQL Tutorial | For Beginners
Learning of Php and My SQL Tutorial | For Beginners
 
Php My SQL Tutorial | beginning
Php My SQL Tutorial | beginningPhp My SQL Tutorial | beginning
Php My SQL Tutorial | beginning
 
WT_PHP_PART1.pdf
WT_PHP_PART1.pdfWT_PHP_PART1.pdf
WT_PHP_PART1.pdf
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
php basics
php basicsphp basics
php basics
 
Introduction To Php For Wit2009
Introduction To Php For Wit2009Introduction To Php For Wit2009
Introduction To Php For Wit2009
 
Php7 HHVM and co
Php7 HHVM and coPhp7 HHVM and co
Php7 HHVM and co
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Living With Legacy Code
Living With Legacy CodeLiving With Legacy Code
Living With Legacy Code
 
Giới thiệu PHP 7
Giới thiệu PHP 7Giới thiệu PHP 7
Giới thiệu PHP 7
 

Último

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 

Último (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 

PHP: The easiest language to learn.

  • 1.
  • 2. PHP P HP: H ypertext P reprocessor PHP: Hypertext Preprocessor PHP: Hypertext Preprocessor PHP: Hypertext Preprocessor PHP: ... Like GNU.
  • 3.
  • 5.
  • 6. Variables $ Prefix for variables $name = 'ILUG' ; // String $year = 2008 ; // Number $is_php_good = true ; // Boolean // is a comment – as is /* to */ - PHP follows the C Syntax
  • 7. Arrays/Hashes $arr = array(“Indian”, “Linux”, “User”, “Group”); $arr[1] = 'Libre'; print $arr[1]; $details = array( “abbr” => “ILUG”, “full” => “Indian Libre User Group” ); print $details['full'];
  • 8.
  • 9. Control Flow: if If if($name == 'Binny') { print “Hi, Binny”; } elseif($name == 'Sameer') { print “Hello Sameer”; } else { print “Hello everybody”; }
  • 10. For/Foreach For $languages = array('PHP', 'Ruby', 'JavaScript', 'Python', 'Perl', 'Tcl'); for($i =0; $i < count($languages); $i++) { print $i+1 . “) “ . $languages[$i]; } Foreach foreach($languages as $lang) { print $lang; }
  • 11. While Loop $i = 1; While($i < 10) { print $i; $i++; }
  • 12. Functions function hello($name) { print “Hello, $name.”; } hello(“World”);
  • 13.
  • 14. Class class Movie { public $name; function __construct($movie_name) { $this->name = $movie_name; } function show() { print $this->name; } } $film = new Movie(“City of God”); $film->show();
  • 15. Getting Help PHP Manual(CHM) Install KCHM to view it.
  • 16.
  • 17.
  • 18. Connection mysql_connect('localhost', 'root', 'password'); mysql_select_db('database_name'); Use a database abstraction layer. $db = new Sql(“localhost”, 'root', 'password', 'database_name');
  • 19. Executing Queries $sql_handle = mysql_query(“SELECT id,name FROM users WHERE status='1'”) or die(mysql_error()); $result = mysql_fetch_assoc($sql_handle); print $result['name'];
  • 20. Fetching Result while($result = mysql_fetch_assoc($sql_handle)) { print $result['name']; } Use Database Abstraction layer!
  • 21. PHP and the Web Embedding PHP... <strong><?php print hello($name) ?></strong>
  • 22. Form Submission <form action=”action.php” method=”post”> Age: <input type=”text” name=”age” /> <input type=”submit” name=”action” value=”Save” /> </form>
  • 23. action.php if($_POST['action'] == 'Save') { print $_POST['age']; }
  • 24.
  • 25.
  • 26. Credits Getting Help: http://www.flickr.com/photos/doctorow/2496308570/ MySql: http://www.flickr.com/photos/johnniewalker/359440369/ Framework Image : http://www.sxc.hu/photo/916787 Free Software: http://www.flickr.com/photos/marcomolinari_it/2474783234/