Modify weekdays php 5.3

Recently I needed to add a certain amount of weekdays onto a date using php 5.3.

I wrote this simple function which has two parameters, the amount of weekdays I want to add and the date I want to add them to as an instance of DateTime as follows:

public function addWeekdaysToDateTime($weekDays, DateTime $date){
    $days = 0;//counter
    $weekendDays = array('Sat', 'Sun');//days to ignore

    //only increase the day count for weekdays
    while ($days < $weekDays){

        $date->modify("+1 day");

        //if we're now on a weekday, increase the weekday counter
        if(!in_array($date->format("D"), $weekendDays)){

    return $date;

SVN 1.6 Command Line Tools In OS X Mavericks


After updating my Mac to OS X Mavericks I though it best to checkout any updates my fellow developers had done to the site since I last checked out. Opening up terminal and typing SVN update gave me a message saying I need to install Command Line Tools – It gave me a dialog box to install it there and then, very good I thought until I tried again after the install as it said my Mac had SVN 1.7 but my project was made using the older 1.6 and needed to be upgraded which isn’t feasible for me.

To roll back to 1.6 I moved svn out of /usr/bin to my Documents folder just incase I needed to move it back later with this (note the ~):

sudo mv /usr/bin/svn ~/Documents/svn_1.7

After this SVN 1.7 wouldn’t load so I could safely replace it with SVN 1.6 by firstly downloading the latest Xcode from the app store. After Xcode was installed I looked at ‘show package contents’ in finder, browsed through the folders and saw it had Subversion 1.6 included. To point my Mac towards this I needed to edit my /etc/paths file and include this new location as follows:

sudo vi /etc/paths

I then just needed to create a new line at the bottom by entering the new path as so:


After saving the changes and restarting I ran the following command which showed me I had SVN 1.6 installed!

svn help

SVN 6 Months In


After 6 months daily use of SVN – Subversion and being part of a team of 8 developers I can clearly see the benefit of using a software version control system. I can’t imagine how hard it would be to keep track of what’s going on if still using ftp.

A few simple commands and you can pull in other peoples changes to your machine or commit your own :

# svn update (downloads any updates made in the repository)
# svn commit (commits and uploads your local changes to the repository)
# svn info (gives you information about the repository)
# svn stat -u (shows you local and repository changes)

Taking A Hiatus

I’ve got myself a shiny new full time job as a LAMP Developer so I’m having a break from my freelance work for the moment whilst I delve deeper into OO PHP. I’ll be working with a mixture of PHP frameworks and technologies and will be part of a team of 8 developers so will be ditching FTP and going straight into SVN to manage version control. I’ll let you know how I get on.

Classic Car Safe Launched

Classic Car Safe has recently gone live and I’m really happy to be a part of it. The design is based around their grid style logo and the website uses a lot of CSS including some newer CSS3 elements which had to be worked around to make them backwards compatible with Internet Explorer 8. Feature wise it’s updated using a Content Management System (CMS) and has some jQuery for the car carousel in the header.

Version Control

I’ve always organised my projects in a well structured manner and since I’ve been using Aptana Studio 3 I’ve grown ever curious about git/subversion; distributed version control systems which should help to manage my source code further.

Aptana has a built in terminal client with familiar linux commands so within 5 minutes I’ve already created my first git repository and made my first commit using the very good tutorial available at

Initially I’m going to use terminal to handle commits, changes and staging steps for my private projects before downloading a GUI which can interface with GitHub for publishing any open source code.

$ git add hello.php
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
# modified: hello.php

Prufrock Coffee

I’m very pleased to be working with the great Prufrock Coffee of Leather Lane, London from world barista champion Gwylim Davies. I’ve helped with some general website maintenance, setting up emails, fixing a few gremlins and proudly moving the site over to Host My Content.

A Great Web Application IDE

Starting on my object oriented PHP adventure I’ve already discovered the amazing web application IDE Aptana Studio 3 and can’t recommend it enough. It’s really increased my productivity with its code assist tools, error highlighter, SFTP support and lovely themes to make it easy on the eye. – It’s even got built in Git integration. MVC is a dream!