PHP 101 crash-course

PHP 101 crash-course

Guide to PHP web delopment, 101 Powerful PHP Code Snippets

About the Book

This book is an introduction into web development using PHP. PHP is a dynamic scripting language used in many places such as Wordpress or joomla, eCommerce platforms, social networking/media websites and more. 

PHP can be used to develop web pages, or even web apps. PHP is widely used with other languages such as HTML, CSS, Ajax and XML, so the learning doesn't stop here!

This book caters for the absolute beginners to the intermediate and advanced PHP developers. It takes you through from what is a variable to a  nice snippet I found on backing up a databases or their individual individual tables and emailing them out.

This book is aimed at getting the beginners up to scratch, but the snippets are just amazing works of art. One or two are mine, the rest I have collected online over the years, and they have come in handy more than once.

I hope to show you the true beauty and art behind coding, such as what I have found, it is amazing and fun. There is no feeling like launching a new site, or seeing an application you wrote be in use By others! 

  • Share this book

  • Categories

    • Management
    • Self-Help
    • Software
    • Textbooks
  • Installments completed

    5 / 5

  • Feedback

    Email the Author(s)

About the Author

Josh Harington
Josh Harington

Josh is a professional pillow fighter by day and a developer by night. Josh co-founded a Silicon Valley based company called Change Nexus. He works on many projects form CRM's, mobile apps, internat process management for organizations of all sizes. 

He is also a paper cut survivor. 

Table of Contents

  • Chapter 1: Housekeeping
    • What is PHP?
    • What you should Already Know
    • Localhost vs. Online server
    • Installing a Web Server
  • Chapter 2: Programming starts here!
    • The Basics
    • Functions
    • Arrays
  • Chapter 3: Extra to know
    • Date Function
    • Include and Require
    • Cookies
    • Sessions
  • Chapter 4: Forms and Email
    • Get and Post
    • Form Handling
    • Required fields
    • Validating
    • Emails
  • Chapter 5: Code Snippets, Tips and Techniques
    • Adjusting the server time to a timezone
    • Append Non-Breaking Space Between Last Two Words
    • Applying Even/Odd Classes
    • Associative Array using a While loop
    • Automatic Copyright Year
    • Automatic Mailto Links
    • Backup Database
    • Basic Database Connection, Random Query, Display Result
    • Basic SimplePie Usage
    • Blacklist Lookup
    • Build a Calendar Table
    • Bulletin Board Code (BBC)
    • Calendar Function
    • Change date from dd/mm/yyyy to yyyy-dd-mm
    • Change Graphics Based on Season
    • Change Month Number to Month Name
    • Check if File Exists / Append number to Name
    • Check if a website is available
    • Cleaning Variables (helps security / injection)
    • Concatenate Array for Human Reading
    • Convert Accented Characters
    • Convert BR to Newline
    • Convert Comma Separated String into Array
    • Convert HEX to RGB
    • Count Script Execution Time
    • Create Data URI’s
    • Create Unique AlphaNumeric
    • Create URL Slug from Post Title
    • Crop Images
    • Cross Domain GET Forwarding
    • Detect an Ajax Request
    • Detect Location by IP Address
    • Discover and Display Meta Tags
    • Display FeedBurner Feed Count
    • Dropdown Menu from an Array
    • Email Address Validation
    • Email Protector
    • English Time to Seconds
    • Error Page to Handle All Errors
    • Extract Email Addresses
    • Find All Links on a Page
    • Find the File Extension
    • Find Highest Numerically Named File
    • Find the Full Path to the File
    • Find URLs in Text, Make Links
    • Force Leading Zero
    • Generate CSV from Array
    • Get Current File Name
    • Get Current Page URL
    • Get File Last Updated Date
    • Get File Size
    • Get GEO-IP Information
    • Get Image Information
    • Get Suffix of Given Number / Date
    • Return Date of Month with Appropriate Suffix
    • Get Users IP Address
    • Get Width/Height of Image
    • Highlight a Substring
    • HTML Tidy
    • HTTP or HTTPS
    • Import CSV into MySQL
    • Increase Max PHP Upload Size
    • Insert Element every nth Loop
    • Intelligent PHP Cache Control
    • Login Function Script
    • Make a Random Number
    • Options to Truncate Strings
    • Output Buffering
    • Pagination Function
    • Parse JSON
    • Pass Array through the CLI
    • Password Strength
    • Perfom Function on Each Item of an Array
    • PHP Array Contains a value
    • PHP IE Detection
    • PHP Redirect
    • PHP Zebra Stringing a Table
    • Quick Alphabetic Navigation
    • Random Array Values
    • Random HEX Colour
    • Random Slogan Displayer
    • Random String from Pre-Determined Characters
    • Randomize Background Image
    • Randomize File Name
    • Read/Write Files
    • Return Between
    • Return Only One Variable from MySQL Query
    • RSS Generator
    • Sanitize Database Inputs
    • Sending a Text Message via PHP
    • Separate First and last Name
    • Server Side Image Resizer
    • Simple Zipcode Range Tester
    • Time Ago Function
    • Truncate Long String Exactly In Middle
    • Truncate Strings by Words
    • Unzip Files
    • Update Values of Entire Table
    • URL Validation
    • Variable Variables
    • Zero Padded Numbers
  • Chapter 6: Acknowledgements and Sources
    • Acknowledgements
    • Sources

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub