Skip to content

The Joy of PHP

A Beginners Guide to Programming with PHP and mySQL

  • Home
  • About the book
  • Get the Code
  • Buy the book

Category: Code Samples

How I built ‘BoatRampDirectory.com’ using PHP, mySQL, and Google maps

Posted on September 13, 2013September 13, 2013 by Alan

How I took sample code from an article on Google Dev works and used it to build a Google maps enabled boat ramp finder

Continue Reading
Code Samples

Using the PHP Switch Statement

Posted on February 7, 2013 by Alan

The switch statement is similar to a series of IF statements on the same expression. In many occasions, you may want to compare the same variable (or expression) with many different values, and execute a different piece of code depending on which value it equals to. This is  what the switch statement is for. [php] […]

Continue Reading
Code Samples Leave a Comment on Using the PHP Switch Statement

Variables – Good Form

Posted on October 8, 2012February 7, 2013 by Alan

This is a small example of the ‘good’ form of variable naming.  What’s good about it is the fact when you read the code:   echo “This $brand $model is a $year <br>”;  it is fairly easy to guess which variable is which.  Contrast this with the ‘bad form’ variables, which is much harder to read. […]

Continue Reading
Code Samples Leave a Comment on Variables – Good Form

Variables – Bad Form

Posted on October 8, 2012February 7, 2013 by Alan

This is a small example of the ‘bad’ form of variable naming.  What’s bad about it is the fact when you read the code:   echo “This $a $b is a $c <br>“;  it is all but impossible to guess which variable is which.  Contrast this with the ‘good form’ variables, which is much easier to […]

Continue Reading
Code Samples Leave a Comment on Variables – Bad Form
Recent Posts
  • 6th Edition now available
  • Running the code in a Docker Container
  • Updated website
  • Sorry for the outage
  • Happy 20th birthday to PHP
Recent Comments
    RSS SitePoint
    • Quick Tip: Creating Polymorphic Components in TypeScript
    • How to Remove a Background in Photoshop: 7 Quick & Easy Methods
    • WooCommerce vs Shopify: Which Is the Better Choice for You?
    • Designing for All: The Basic Principles of Web Accessibility
    • A Complete Guide to LangChain in Python
    • Extending the Properties of an HTML Element in TypeScript
    • A Comprehensive Comparison of TypeScript Type vs Interface
    • Node.js vs Django: Which is Better for Web Development in 2023?
    • Quick Tip: Decorators in TypeScript
    • An Introduction to LangChain: AI-Powered Language Modeling
    Archives
    • July 2020
    • January 2020
    • December 2019
    • November 2016
    • June 2015
    • January 2014
    • November 2013
    • September 2013
    • August 2013
    • June 2013
    • March 2013
    • February 2013
    • December 2012
    • November 2012
    • October 2012
    • September 2012
    Categories
    • Code Samples
    • Draft
    • eBook
    • MySQL
    • PHP Syntax
    • Sponsors
    • Uncategorized
    • Updates
    Meta
    • Log in
    • Entries feed
    • Comments feed
    • WordPress.org
    Bootstrap 4 WordPress Theme | Theme Name: WP Bootstrap 4.