Docnet PHPNW 2012 Competition Brain Teaser Answer
A couple of people have emailed in to ask what the answer was to our competition brain teaser this year...
So, this year we went for something a little less PHP-specific.
About 30% of entrants got this one right - so well done to all of you!
The very first step with this challenge is recognising base64 encoded data when you see it - which is pretty easy if you've ever worked with email content or the CSS embedded image data-uri feature.
WW8gZGF3Zywgd2UgaGVhcmQgeW91IGxpa2UgYmFz
ZTY0OlIwbEdPRGxoS0FBS0FJQUFBQUFBQVAvLy95SDV
CQUFBQUFBQUxBQUFBQUFvQUFvQUFBSS9qSStweXdr
ZkhvaHlJbmh0MWdiaWVIQ2dRM1laRmFhcEtGN3VwRl
VrdTN3bXJJNTNXYnZtcjZ0d1dybGdMbGFrQVNVVW1L
emppVEpEdG9iMTJpZ0FBRHM9
So, after we pass the string through base64_decode(), we get the following output:
Yo dawg, we heard you like base64:R0lGODlhKAAKAI
AAAAAAAP///yH5BAAAAAAALAAAAAAoAAoAAAI/jI+py
wkfHohyInht1gbieHCgQ3YZFaapKF7upFUku3wmrI53
Wbvmr6twWrlgLlakASUUmKzjiTJDtob12igAADs=
Pop culture reference up next (pimp my ride) - and into the repeated encoding... another base64 encoded string.
Decoding this second string give us some binary output - but with one give-away human-readable prefix:
GIF89a...
So, writing the output of the last decode to a gif file completes the process:
file_put_contents('test.gif', base64_decode($str_data));
And finally, the magic phrase:

Which is a nod to the competition prize - a brand new MacBook Air 13".




This week saw the launch of the first national daily newspaper for almost 25 years, a brave move in today’s digital age when many choose to access the news online. i went on sale Tuesday with the aim of targeting lapsed readers of quality newspapers. The idea is to serve the time poor by summarising the day’s news from around the globe in short concise articles. The paper also comes at a much lower price than its parent paper, The Independent, at just 20p. 
