Learn PHP in 24 Hours
By Alex Nordeen
()
About this ebook
PHP is a versatile language based on object-oriented programming concept. It is practiced by a huge community. PHP is the least complex and makes better applications if used in the right context. It supports some great frameworks like Zend, Laravel, and Symphony.
Most beginners find PHP difficult because they either spend a long time learning all the things, or they are using poorly crafted online courses. To make PHP easier to learn, we extracted some niche topic of PHP and compiled them in simple to understand format in this small e-book. On top of it, the examples are made more interactive to help understand some advanced PHP topics. The best part of this e-book is the price is almost negligible.
With this edition, beginners will learn to interpret PHP language in the nick of time. They will able to build a basic application on HTML, CSS, etc. without any peer guidance or external course. All the major concept of PHP are covered in this e-book. Once you know the tips and tricks, the book can be a guide for building Web-based services for mobile devices. You will be able to gain more knowledge about PHP functions and MySQL through it.
Besides having limited coding language, you will become someone having a deeper understanding of PHP in no time. With this e-book, you soon can become the part of these huge base of PHP users like Facebook, Yahoo, Wikipedia, Wordpress, and so on.
Table of Contents
Chapter 1: Introduction
What is a scripting language?
Scripting VS Programming Language
What does PHP stand for?
Php Syntax
What is PHP used for & Market share
PHP vs ASP.NET VS JSP VS CFML
Chapter 2: Introduction to XAMPP
What is XAMPP?
How to Download and Install XAMPP
XAMPP Control Panel
What is the best PHP IDE?
Introduction to Netbeans IDE
Creating a new PHP project using the Netbeans IDE
Chapter 3: Data Types, Variables and Operators
Data Types
Variable
Variable Type Casting
Constant
Operators
Chapter 4: Comments, Include & Require
Comments
Include & PHP Include_once
Require & PHP require_once
include vs require
Chapter 5: Arrays
What is an Array?
Numeric Arrays
Associative Array
Multi-dimensional arrays
Arrays: Operators
Chapter 6: Control structures
What is a control structure?
IF Else
PHP Loop
While Loop
Switch Case
Chapter 7: Strings
What is a string?
Create Strings Using Double quotes
Heredoc
Nowdoc
String functions
Chapter 8: Functions
What is a Function?
Built in Functions
String Functions
Numeric Functions
Date Function
Why use User Defined Functions?
Chapter 9: Forms
What is form?
Create a form
POST method
GET method
GET vs POST Methods
Processing the registration form data
Chapter 10: Cookies & Sessions
Chapter 11: File Processing
Chapter 12: Error Handling
Chapter 13: Regular Expression
Chapter 14: MAIL
Chapter 15: Database Access
Chapter 16: OOPS
Read more from Alex Nordeen
Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Learn SAP MM in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn SQL in 24 Hours Rating: 5 out of 5 stars5/5Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5Learn SAP Basis in 24 Hours Rating: 5 out of 5 stars5/5Learn PMP in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn HANA in 24 Hours Rating: 5 out of 5 stars5/5Learn JavaScript in 24 Hours Rating: 3 out of 5 stars3/5Learn SAP SD in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn Selenium in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn Software Testing in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn Data Warehousing in 24 Hours Rating: 0 out of 5 stars0 ratingsBusiness Analysis : Learn in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn SAP HR in 24 Hours Rating: 5 out of 5 stars5/5Learn MongoDB in 24 Hours Rating: 5 out of 5 stars5/5C++ Learn in 24 Hours Rating: 0 out of 5 stars0 ratingsHacking : Guide to Computer Hacking and Penetration Testing Rating: 5 out of 5 stars5/5Learn Operating System in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn AngularJS in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn SAP BI in 24 Hours Rating: 3 out of 5 stars3/5Learn Excel in 24 Hours Rating: 4 out of 5 stars4/5Learn R Programming in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn C Programming in 24 Hours Rating: 0 out of 5 stars0 ratingsC# for Beginners: Learn in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn Hadoop in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn SQLite in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn Design and Analysis of Algorithms in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn Cassandra in 24 Hours Rating: 0 out of 5 stars0 ratingsLearn JSP in 24 Hours Rating: 0 out of 5 stars0 ratings
Related to Learn PHP in 24 Hours
Related ebooks
The PHP Workshop: Learn to build interactive applications and kickstart your career as a web developer Rating: 0 out of 5 stars0 ratingsLearn PHP Programming in 7Days: Ultimate PHP Crash Course For Beginners Rating: 3 out of 5 stars3/5PHP for Beginners: Your Guide to Easily Learn PHP In 7 Days Rating: 4 out of 5 stars4/5Introduction to PHP Web Services: PHP, JavaScript, MySQL, SOAP, RESTful, JSON, XML, WSDL Rating: 0 out of 5 stars0 ratingsHTML, CSS, Bootstrap, Php, Javascript and MySql: All you need to know to create a dynamic site Rating: 4 out of 5 stars4/5Introduction to PHP Rating: 3 out of 5 stars3/5Learning PHP 7 High Performance Rating: 0 out of 5 stars0 ratingsMastering PHP Design Patterns Rating: 0 out of 5 stars0 ratingsPHP Examples Part 3 Rating: 5 out of 5 stars5/5PHP Error Reporting: How To Do It Right Rating: 0 out of 5 stars0 ratingsHow to Learn PHP, MySQL and Javascript Quickly!: For Dummies Rating: 5 out of 5 stars5/5PHP 7 Programming Blueprints Rating: 0 out of 5 stars0 ratingsLearning PHP 7 Rating: 4 out of 5 stars4/5PHP MySQL Development of Login Modul: 3 hours Easy Guide Rating: 5 out of 5 stars5/5PHP & MySQL Practice It Learn It Rating: 3 out of 5 stars3/5Learning PHP Data Objects Rating: 5 out of 5 stars5/5PHP Examples Part 4 Rating: 0 out of 5 stars0 ratingsJavaScript Unlocked Rating: 5 out of 5 stars5/5Introduction to HTML & CSS Rating: 4 out of 5 stars4/5Persistence in PHP with Doctrine ORM Rating: 0 out of 5 stars0 ratingsJavascript For Beginners: Your Guide For Learning Javascript Programming in 24 Hours Rating: 3 out of 5 stars3/5P.H.P Simple C.R.U.D Design Rating: 4 out of 5 stars4/5Getting started with php & mysql: Professional training Rating: 0 out of 5 stars0 ratingsPHP Examples, Part 2 Rating: 1 out of 5 stars1/5Learn C Programming in 24 Hours Rating: 0 out of 5 stars0 ratingsC# for Beginners: Learn in 24 Hours Rating: 0 out of 5 stars0 ratingsPHP Team Development Rating: 3 out of 5 stars3/5C# Programming Illustrated Guide For Beginners & Intermediates: The Future Is Here! Learning By Doing Approach Rating: 0 out of 5 stars0 ratings
Programming For You
HTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 0 out of 5 stars0 ratingsLearn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5The Unofficial Guide to Open Broadcaster Software: OBS: The World's Most Popular Free Live-Streaming Application Rating: 0 out of 5 stars0 ratingsCoding All-in-One For Dummies Rating: 4 out of 5 stars4/5Java for Beginners: A Crash Course to Learn Java Programming in 1 Week Rating: 5 out of 5 stars5/5Hacking: Ultimate Beginner's Guide for Computer Hacking in 2018 and Beyond: Hacking in 2018, #1 Rating: 4 out of 5 stars4/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5Python Projects for Beginners: A Ten-Week Bootcamp Approach to Python Programming Rating: 0 out of 5 stars0 ratingsSQL: For Beginners: Your Guide To Easily Learn SQL Programming in 7 Days Rating: 5 out of 5 stars5/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5The Little SAS Book: A Primer, Sixth Edition Rating: 5 out of 5 stars5/5Teach Yourself C++ Rating: 4 out of 5 stars4/5Pokemon Go: Guide + 20 Tips and Tricks You Must Read Hints, Tricks, Tips, Secrets, Android, iOS Rating: 5 out of 5 stars5/5Web Designer's Idea Book, Volume 4: Inspiration from the Best Web Design Trends, Themes and Styles Rating: 4 out of 5 stars4/5
Reviews for Learn PHP in 24 Hours
0 ratings0 reviews
Book preview
Learn PHP in 24 Hours - Alex Nordeen
Learn PHP in 24 Hours
By Alex Nordeen
Copyright 2021 - All Rights Reserved – Alex Nordeen
ALL RIGHTS RESERVED. No part of this publication may be reproduced or transmitted in any form whatsoever, electronic, or mechanical, including photocopying, recording, or by any informational storage or retrieval system without express written, dated and signed permission from the author.
Table of Contents
Chapter 1: Introduction
What is a scripting language?
Scripting VS Programming Language
What does PHP stand for?
Php Syntax
What is PHP used for & Market share
PHP vs ASP.NET VS JSP VS CFML
Chapter 2: Introduction to XAMPP
What is XAMPP?
How to Download and Install XAMPP
XAMPP Control Panel
What is the best PHP IDE?
Introduction to Netbeans IDE
Creating a new PHP project using the Netbeans IDE
Chapter 3: Data Types, Variables and Operators
Data Types
Variable
Variable Type Casting
Constant
Operators
Chapter 4: Comments, Include & Require
Comments
Include & PHP Include_once
Require & PHP require_once
include vs require
Chapter 5: Arrays
What is an Array?
Numeric Arrays
Associative Array
Multi-dimensional arrays
Arrays: Operators
Chapter 6: Control structures
What is a control structure?
IF Else
PHP Loop
While Loop
Switch Case
Chapter 7: Strings
What is a string?
Create Strings Using Double quotes
Heredoc
Nowdoc
String functions
Chapter 8: Functions
What is a Function?
Built in Functions
String Functions
Numeric Functions
Date Function
Why use User Defined Functions?
Chapter 9: Forms
What is form?
Create a form
POST method
GET method
GET vs POST Methods
Processing the registration form data
Chapter 10: Cookies & Sessions
What is Cookies?
Creating Cookies
Retrieving the Cookie value
What is a Session?
Creating a Session
Chapter 11: File Processing
What is a File?
File_exists Function
Fopen Function
Fwrite Function
Fgets Function
File_get_contents Function
Chapter 12: Error Handling
What is an Exception?
PHP Error handling
Error handling examples
Difference between Errors and Exception
Multiple Exceptions
Chapter 13: Regular Expression
What is a regular expressions?
Preg_match
Preg_split
Preg_replace
Meta characters
Explaining the pattern
Chapter 14: MAIL
What is PHP mail?
Why/When to use the PHP mail
Simple Transmission Protocol
Sanitizing email user inputs
Secure Mail
Chapter 15: Database Access
mysql_connect function
mysql_select_db function
mysql_query function
mysql_num_rows function
mysql_fetch_array function
Data Access Object PDO
Chapter 16: OOPS
What is UML?
What is object oriented programming?
Creating a class
Inheritance implementation
Using the classes
Testing our application
Chapter 17: Date
What is Date Function?
What is a TimeStamp?
PHP set Timezone Programmatically
Mktime Function
PHP Date function reference
Chapter 18: Security Functions
What is a Security?
Potential security threats
PHP Application Security Best Practices
filter_var function
PHP Md5 and PHP sha1
Chapter 19: XML,DOM, Parsers
What is XML?
What is DOM?
XML Parsers
Creating the index page that reads the XML document
Creating an XML document using PHP
Chapter 20: Sample Project
Opinion Polls
Database
Coding our application
Testing our application
Chapter 21: PHP with Ajax
What is JavaScript?
What is XML?
What is Ajax?
Creating an Ajax application
Chapter 22: Frameworks
What is a framework?
Introduction to PHP MVC framework
Porting the opinion poll application to CodeIgniter
Database configuration settings
Creating Our Model
Creating Our Views
Chapter 1: Introduction
What is a scripting language?
A script is a set of programming instructions that is interpreted at runtime.
A scripting language is a language that interprets scripts at runtime. Scripts are usually embedded into other software environments.
The purpose of the scripts is usually to enhance the performance or perform routine tasks for an application.
Server side scripts are interpreted on the server while client side scripts are interpreted by the client application.
PHP is a server side script that is interpreted on the server while JavaScript is an example of a client side script that is interpreted by the client browser.
Both PHP and JavaScript can be embedded into HTML pages.
Scripting VS Programming Language
What does PHP stand for?
PHP means - Personal Home Page, but it now stands for the recursive backronym PHP: Hypertext Preprocessor.
PHP code may be embedded into HTML code, or it can be used in combination with various web template systems, web content management system and web frameworks.
Define PHP or What is PHP?
The acronym PHP initially stood for Personal Home Pages.
As of version 3, it stands for PHP Hypertext pre-processor. It is a general purpose server side scripting language that is used to develop;
Static websites
Dynamic websites
Web applications
PHP scripts can only be interpreted on a server that has PHP installed.
The client computers accessing the PHP scripts require a web browser only.
A PHP file contains PHP tags and ends with the extension .php
.
The diagram below shows how a PHP programming file looks like.
Php Syntax
echo 'Hello World';
?>
A PHP file can also contain tags such as HTML and client side scripts such as JavaScript.
HTMLis an added advantage when learning PHP Language. You can even learn PHP without knowing HTML but it’s recommended you at least know the basics of HTML.
Database management systems DBMS for database powered applications.
For more advanced topics such as interactive applications and web services, you will need JavaScript and XML.
Why use PHP?
You have obviously head of a number of programming languages out there; you may be wondering why we would want to use PHP as our poison for the web programming. Below are some of the compelling reasons.
PHP is open source and free.
Short learning curve compared to other languages such as JSP, ASP etc.
Large community document
Most web hosting servers support PHP by default unlike other languages such as ASP that need IIS. This makes PHP a cost effective choice.
PHP is regular updated to keep abreast with the latest technology trends.
Other benefit that you get with PHP is that it’s a server side scripting language; this means you only need to install it on the server and client computers requesting for resources from the server do not need to have PHP installed; only a web browser would be enough.
PHP has in built support for working hand in hand with MySQL; this doesn’t mean you can’t use PHP with other database management systems. You can still use PHP with
Postgres
Oracle
MS SQL Server
ODBC etc.
PHP is cross platform; this means you can deploy your application on a number of different operating systems such as windows, Linux, Mac OS etc.
What is PHP used for & Market share
In terms of market share, there are over 20 million websites and application on the internet developed using PHP scripting language.
This may be attributed to the points raised above;
PHP vs ASP.NET VS JSP VS CFML
ASP – Active Server Pages JSP – Java Server Pages CFML – Cold Fusion Markup language The table below compares the various server side scripting languages with PHP
PHP File Extensions
File extension and Tags In order for the server to identify our PHP files and scripts, we must save the file with the .php
extension. Older PHP file extensions include
.phtml
.php3
.php4
.php5
.phps
PHP was designed to work with HTML, and as such, it can be embedded into the HTML code.
You can create PHP files without any html tags and that is called Pure PHP file .
The server interprets the PHP code and outputs the results as HTML code to the web browsers.
In order for the server to identify the PHP code from the HTML code, we must always enclose the PHP code in PHP tags.
A PHP tag starts with the less than symbol followed by the question mark and then the words php
.
PHP is a case sensitive language, VAR
is not the same as var
.
The PHP tags themselves are not case-sensitive, but it is strongly recommended that we use lower case letter. The code below illustrates the