PHP Basics

Basic PHP tips and trick.

At some point in your programming carrier you going to be asked to deal with a date.  I've found PHP has a slew of really useful date utilities to manipulate and change the format of your date or time.  The date function is very useful in formatting your date the way you want to display it.  There are a slew of different setting you can send to the function to format the date exactly how you want it. You can check the PHP website for all the different mask this function supports.

Have you ever wanted to change something in your output in the middle but decided it wasn't worth the 3 extra lines if code in a if statement?

The other day a friend and I were chatting about coding principles and I noticed he had a few points in a script that could be vulnerable.  When you accept input in your script from outside sources we have found that using type casting helps reduce potential errors and exploits.

Okay so this isn't a PHP basic tip but when used in conjunction with other PHP function this can help draw out the results in a readable format. Have you ever wanted to know what exactly was in an array?  I do all the time and I used to write recursive function to help get that information.  Well then when I started to use objects and mixed these with arrays things started to get dicy and my recursive function pucked on me.