It sets the value on the left to be itself plus the value on the right (for example, i+=3 is the same as i = i+3). It’s called the addition-assignment operator.
What does the += operator do?
what does the the -= operator do
It sets the value on the left to be itself minus the value on the right (for example, i-=3 is the same as i = i-3). It’s called the subtraction-assignment operator.
Using a for loop, print the numbers from 0 to 5
I’ve been training for a ZCE certification, and found myself getting quite annoyed with some of the more obvious questions. One of the questions in the beginning of the test was which of the pieces of code would output the numbers 0 to 5 using a for loop. I mean, come on! I present some of my more creative and twisted ways of completing said task.
Operator precedence – what does (i=1)*i-- - --i*(i=-3)*i++ + ++i equal and why?
I was looking at some code from a number of years ago and was horrified by the amount of ‘clever code’ in there. After decoding it, I immediately rewrote it. Then I set myself a challenge. Write the dirtiest expression ever to besmirch a hard-drive, then decode it in a blog post. I present to you with the fruit of my labour.
AJAX is easy, but remember accessibility
AJAX is easy. It’s just javascript talking to your server to grab a little bit of content instead of the browser grabbing the whole thing. With this in mind, let’s get to work and build a simple AJAX application that will work with javascript turned off. We’ll do this by assuming that there is no javascript in your user’s browser, then use jQuery to change the DOM to add in the behaviours.
10 Biggest Milestones in Web Development
Net-tuts shoots and scores yet again with this interesting article about the biggest moments in history which have influenced the internet. It covers everything from Amazon to Linux, PHP to CSS. Great read!
Number to words function in PHP
You know those ‘I have nothing to do this-afternoon so I want to waste some time making something utterly pointless’ moments? Well I get them too. Fortunately however, it turns out that my moment of inspiration led to a very useful script to turn ’123′ into ‘One hundred and twenty three’. Bargain!
Intelligent objects
Please note!! I have shamelessly stolen this article from my old and (even if I do say so myself) rather boring blog. So please ignore the terrible writing style! I’ll rewrite this article in the future, but until then, I present you with version 1.0 Anyone who has worked with the PHP/MySQL duo will no-doubt [...]
Singletons in PHP
Design patterns can be boring things. Especially when the language you’re using keeps changing syntax. I had a bit of trouble implementing a Singleton in PHP, and so I have written this tutorial to explain the errors of my ways.
