Burn this guy at the stake because he’s a witch! You can’t separate out the water from Coca-Cola with a simple water filter. Coke is elemental, inviolable. It’s The Real Thing. Coke Is It.
Who remembers this?
I have found that the iTunes shuffle feature does not randomly shuffle songs. In fact, I can accurately predict the exact sequence of songs that iTunes will play. This frustrates me to no end because I like to listen to my music randomly, but I have a few favourite songs that I always start out with.
Here is the TL:DR answer:
It is random, but the order is only shuffled once, when you turn random play on. If you want to re-shuffle the order, turn random play off and then on again.
This post assumes that you already have some basic knowledge of C and also know the fundamental concepts of the PHP implementation (like zvals). If not, you should read up on them beforehand.
As an example I’ll use the addition of an
inoperator which you might already know from other languages like Python. It works as follows:
$words = ['hello', 'world', 'foo', 'bar']; var_dump('hello' in $words); // true var_dump('foo' in $words); // true var_dump('blub' in $words); // false $string = 'PHP is fun!'; var_dump('PHP' in $string); // true var_dump('Python' in $string); // false
So basically, for arrays the
inoperator is the same as the
in_arrayfunction (but without the needle/haystack problem) and for strings it’s like doing a
false !== strpos($str2, $str1).
Having used PHP for all my previous web based projects, I have my own comfort zone just like all of you. I have my WAMP server that I won’t easily give up, I have a huge/handy collection of code snippets, I have all the experience about numerous frameworks like CakePHP, Smarty, CodeIgniter etc. But things were different with Countly. We were about to build a realtime, pretty complex and open source platform. I could easily visualize the codebase getting out of control, the performance problems along the way and the entire realtime struggle we would face if we choose PHP. It was time for a change…