PHPNW is the 8th annual PHPNW Conference, and I think I'm lucky to be one of the few who have attended every year. This was something that Jeremy Coates mentioned out as we sat down the introductory session, but it was also good to see lots of new people attending the conference as well. It was a great conference with a great community feeling.
The keynote this year was by Meri Williams, who talked about Stealing People Lessons from Artificial Intelligence. Meri's career has been in both development and project management and she was able to use lessons learnt during her PhD thesis on artificial intelligence in order to think about how people respond to work. The concept sounds a little un-emotional at face value, but part of the principles of AI is making sure that all agents have their own goals. Meri was a funny and engaging speaker who talked about all kinds of interesting aspects of how people learn and grow.
At the LAMP and Beyond III event (run by PHPNW) this weekend we set ourselves the task of giving PHP7 a go. Below is some nodes from that session.
This assumes that you’ve already installed PHP5.6 along with Apache and MySQL. Installing PHP5.6 via apt-get is fine as we just need some of the dependencies to be present.
To get the the code for PHP7 you need to clone from the PHP repo on Github.
New in PHP 5.5 is a group of functions that deal with password hashing and verification. This is such a common thing for PHP applications to do that it was decided to include it into the core of PHP. They effectively solve the problem of hashing and comparing passwords that just about every PHP developer has implemented at one point or another.
There are only a few functions available but they provide all of the functionality needed to create a hash value from a password, check if the hash is valid and to check if the password hash needs to be recreated.
The Monty Hall problem is a counter intuitive problem in probability mathematics that deals with picking the right prize from a set of three doors. The problem is named after the television celebrity Monty Hall and is loosely based on the USA game show Let's Make a Deal.
The sieve of Eratosthenes is named after Eratosthenes of Cyrene who was a Greek mathematician who devised a mechanism to find a sequence of prime numbers using a simple algorithm.
Normally, looping through a list of numbers and finding the primes can be an expensive process. The seive of Eratosthenes is one of the most efficient way of working out all of the smaller prime numbers below (below 10 million or so).
Getting the first or last item from an array in PHP is usually quite easy. If you create an array and then add a bunch of values to it then the array index will increment by 1 for every element you add. This means that in order to get the first element from an array you just reference the default stating position (0). To get the last item in the array the index key will be the length of the array, minus 1. Here is some example code showing this.