Joined January 2013
·

Bryan te Beek

Student Computer Science
·
The Netherlands
·
·
·

Great tip!

Remember that you can always change the symlink to

/usr/local/bin/sublime

if you like the full name over the abbreviation (as I do).

Posted to Always Return An Even Number over 1 year ago

I had to remove the count() before it worked. Also why don't you do a bitwise check, if the first bit is 1, we know it's an odd number:

// Add or substract 1 if it's odd
echo $num & 1 ? $num + 1 : $num;

For more information about bitwise operators check:
http://php.net/manual/en/language.operators.bitwise.php

Also note that the rounding seems a bit unpredictable, both 12345 and 12343 returned 12344 in your case.

Posted to Check a 1D array for emptiness over 1 year ago
if (! array_filter($values, 'strlen'))

I think this line is more verbose, but I got to admit that it's a bit slower than @kanuj 's. Just a matter of preference I guess.

Achievements
88 Karma
0 Total ProTip Views