Salting passwords

The process known as salting provides extra security for protecting your passwords and for that matter any encrypted data. The best way to describe salting is a bit like a key to double lock and unlock data. In fact, if you imagine an average set

OOP Scope – Public, Private and Protected

In this post we will be exploring OOP scope in PHP.  At it's broadest interpretation scoping means determining what methods and variables can be exposed, how and in what context. Public means accessible to everywhere and everyone that needs the method or variable and is great

Building Classes

In this post we build a class to process recipes in a recipe app.  We will explore how to initialise a class, define properties, create objects and call methods. So what do we want our class to do? Fetch recipes Add recipes Update recipes Remove recipes Let's

Storing & retrieving data with Arrays

Arrays are like lists. In programming terms arrays are the same as variables that store data but the crucial difference is they store elements of data that is normally related in some way. Think of them a bit like a draw - take a kitchen

Ternary Operator (:?)

The ternary operator is a shorthand for if/else. Why bother with the ternary operator? Wherever possible it makes sense to optimize your code. In so doing you reduce the load on the server and write less code (never a bad thing!). By optimizing your scripts as much

The anatomy of a PHP cookie

What is a cookie? A cookie is a text file that is sent from the server and is stored in the browser’s cache. Cookies can enhance the usability of your application by either setting predefined variables within the application or gathering information entered by the user

PHP Strings

In this post we will explore: Prebuilt string functions Regular Expressions Escaping strings echo vs print printf and sprintf First of all what is a string? Strings are variables, they contain characters (Variable characters). They could also be considered as a type of array. Prebuilt String Functions PHP provides excellent support for strings: http://php.net/manual/en/ref.strings.php.

Global and Local Scope in PHP

Global and Local scope in applications programming is a crucial aspect that needs to be properly understood.  Particularly the global aspect. So what does global mean in a programming context? Global means that data or logic can be accessed anywhere in the application by anything without restriction.