Archive for December 2015

git compare branches

git diff master 0.2   git diff 0.1 0.2

php tip not to use count in for iteration

Dont use count() in loops because each iteration will count the number of elements; make a variable $count = count($array) and use the variable instead

php using sorting methods

class Newclass {   public static function compare($a, $b) { return strcmp($a["name"], $b["name"]); }   }   usort($array_to_srt, array("Newclass", "compare"));       uasort($array_to_srt, array("Newclass", "compare"));   The difference between usort and uasort is that uasort keeps the keys, usort resets them and enumerate from scratch.

Git overwrite local branch to match remote branch

git reset –hard origin/master