Posts

Showing posts with the label PHP

PHP: Built-In Functions

In PHP, or any other coding language, a function is a reusable piece of code that you can call on throughout your application or script. PHP has over 1000 built in functions.

PHP: Loops

Sometimes when we're coding, we want to do something that would be very tedious. This is where loops come in. Loops repeat a series of instructions for you for a specified number of times.

PHP: Arrays

Back to more PHP, you may be wondering how PHP stores information. It can call or modify information in an SQL database, but we'll cover that later. So far, we know that we can save individual bits of information as variables. Let's look at Arrays. An Array is a list, and it allows you to save more than one bit of information within a single variable. Array Syntax A very simple array, could simply be a shopping list, like the example below. <?php       $SampleArray = array("Egg", "Tomato", "Beans");     ?>   An array starts with a variable, and then is followed by the =, just like we've done before. However, the array() portion of the statement is where we can put in multiple values. These could be strings, numbers, and/or previously declared variables. The information within the ellipses are separated by commas and each string is within double quotes, just like we've seen with past variable declarations or echo statements....

PHP: Flow Control

The phrase "Flow Control" might sound weird, as though we're talking about fluids or money. It sounds vague and almost clinical. While "Flow Control" might be something to think about for a variety of other topics, we're going to look at the flow control of data in PHP. As mentioned in the introductory post, lines of PHP code are referred to as statements. When we explored some of the syntax in the last post, the lines of code for declaring variables, performing mathematical operations, or echoing strings were all statements. Below, let's look at the statements we'd use to control the flow of information within a PHP script. Co mparisons Comparisons in PHP are done with Comparison Operators. I've listed the symbols below. > Greater than < Less than >= Greater than or equal to <= Less than or equal to == Equal to != Not equal to For example, below, we're going to see a PHP statement stating that 6 is less than ...

PHP: An Introduction

Have you had an idea for an application? Perhaps you have an idea for a web-app. Maybe you have a niche problem you'd like to solve, or maybe you just want to learn more about programming and software development. PHP is very capable and it's easy to get started. This is the first in a series of posts teaching PHP. I'll also have posts on SQL so you can work with information in databases and Git so you can use version control for your code. So, why PHP?

Apache, MySQL and PHP on the Raspberry Pi 3

Image
As mentioned before, I'm setting up a LAMP stack using Cent OS v7 on my Raspberry Pi 3. LAMP stands for Linux, Apache, MySQL and PHP. The A for Apache could also be E for Nginx (pronounced like Engine-Ecks) and the P for PHP could also be P for Perl or Python. This software together forms what's referred to as a "stack", which is simply a common development term for a set of software that works together for a specific application. In this post, I'll be covering the installation and initial configuration of Apache, MySQL and PHP.