PHP has many different template solutions, and the beauty of them all is how simple it makes maintaining and changing your website. Back in the day when everything was handled with static HTML files – if you needed to add a new link to your main menu – you found yourself editing dozens if not […]
Category Archives: PHP Tutorials
How PHP Functions Work
A PHP function is merely a block of code that can be defined once and then reused throughout various other parts of your script/program. Typically, a function takes an argument, or a series of arguments, and performs a predefined set of operations on them – returning a value as a result. With PHP functions, code […]
The PHP Ternary Operator
PHP has plenty of different operators, the majority of them being either unary or binary operators. A unary operator, such as !, performs its operations on just one single value. A binary operator, such as =, is used to perform an operation on two operads. So following the naming logic you’ve probably already figured out […]
File Upload via PHP/MySQL
As per the request of SpaculusĀ I have decided to put together a tutorial discussing how to upload an image to your server, and store the information about that uploaded image into your MySQL database. This is a function that can often come in handy when developing a user membership system with avatar support, or a […]
Escaping Characters and Variable Expansion
Escaping characters is basic, but essential to an error-free PHP script. Consider the following sentence for example: Mike’s uncle said, “Isn’t that cool?” Now if we attempt to use PHP to echo this sentence to the browser, those quotes and apostrophes will cause some problems. The quotes and apostrophes inside the string are confused for […]
Display Page Loading Time
Have you ever noticed that lots of websites feature some text towards the very bottom of a page saying “Page took x.xxx seconds to load”? It’s a pretty simple thing to make and gives your site something that we all love … stats! So today we’ll take a look at how to accomplish this through […]
Connecting to a MySQL Database
None of our previous PHP tutorials have dealt with a database yet, and that is for the sole reason that not everyone has access to a database, however for those who do this tutorial will teach you the basics on how you can connect to your database. We wont be covering SQL queries and the […]
PHP Variables – Understanding The Basics
If you have ever looked through any programming language – or still remember those algebra classes when you learned what 3+x=5 means then you already know what a variable does. A variable stands for something else, or in PHP it stores something inside of it so that you can recall it later on in your […]
Getting Things Started With An Echo();
Chances are you’re familiar with the Hello World exercise by now. It’s the starting point for learning almost any programming language. PHP is no different. So let’s dive right into it. How do we display things using PHP?