Count Days Between Two Dates in php

<div class="line number1 index0 alt2">

function getTotalDays($fromDate,$toDate,$addLastDay = false){
    $date1 = new DateTime($from);
    $date2 = new DateTime($to);
        $date2-&gt;add(new DateInterval('P1D'));
    return $date1 -&gt; diff($date2)-&gt;days;
echo getTotalDays('2011-04-11','2011-04-15');
echo getTotalDays('2011-04-11','2011-04-15',true);


[ important ] [ fine and workable ] mysql case sensetive query

A good solution when mysql case sensetive query
MySQL queries are not case-sensitive by default.
Following is a simple query that is looking for ‘value’. However it will return ‘VALUE’, ‘value’, ‘VaLuE’, etc…

// query ... 
SELECT * FROM `table` WHERE `column` = 'value'
if you need to make a case-sensitive query, it is very easy to do:
SELECT * FROM `table` WHERE BINARY `column` = 'value'