PHP Best Practices For Beginners

cli

In PHP, and really in just about every programming language in existence, there are certain things that are important to remember. Some of them are very general and can be applied to almost all programming languages, while others are best associated with one specific programming language.

In this post you will find nine PHP best practices that everyone really should follow.

Test Your PHP Apps On Your Own Computer

servers

I am often asked about by people how they should test their PHP applications. Because PHP is a server-side programming language, you can't just open the file in your web browser, like with HTML or JavaScript. You need to upload it to a server where the script can be run. But what if you don't want to rent space on a server, or if you want to make testing of PHP scripts much faster?

Simple CRUD With CodeIgniter

ci_logo

Last week we took a look at an introduction to the CodeIgniter PHP framework. In that example we saw the basics of how CodeIgniter works and the basics of the MVC pattern. But we didn't really do much with models. Today we will look at the power of models in CodeIgniter to make CRUD functions easy.

An Introduction to CodeIgniter

ci_logo

CodeIgniter is really one of my favourite web development frameworks for PHP. It's lightweight, fast, and very easy to quickly get something working in. It follows a model-view-controller (MVC) pattern, and comes with many helpful libraries to help you get started. If you want to try out your first framework, CodeIgniter is the one to start with.

Build Your Site With Dynamic CSS

Image source

Changes to the style of the CSS of a website can be done very easily, with the magic of JavaScript. However, JavaScript can be disabled, so it should be avoided for important things.

The solution would be to use a server-side language, like PHP, to make it possible to create dynamic CSS files without having to resort to using JavaScript. Finally you can use dynamic CSS that works in all browser configurations.