Update your Twitter status using PHP

Twitter is an awesome service! I use it on a daily basis and have grown addicted to it. Posting to twitter VIA an application is something that I’m sure you’ll need to do at some point. Using this simple little script below, you can post updates to twitter accounts fairly easily. Don’t forget to add your… Continue reading Update your Twitter status using PHP

Extract data from csv file/ Import csv file in php

You can use fgetcsv to parse a CSV file without having to worry about parsing it yourself. $row = 1; if (($handle = fopen(“test.csv”, “r”)) !== FALSE) {     while (($data = fgetcsv($handle, 1000, “,”)) !== FALSE) {         $num = count($data);         echo “<p> $num fields in line $row:… Continue reading Extract data from csv file/ Import csv file in php

Calculate the difference between two dates using PHP

The simplest way to calculate the difference between two dates is… Function : <?php function date_difference($start_date, $end_date) {   $date1 = new DateTime($start_date); $date2 = new DateTime($end_date); $interval = $date1->diff($date2); echo “difference ” . $interval->y . ” year(s), ” . $interval->m.” month(s), “.$interval->d.” day(s) “; } ?> usage : <?php date_difference(“2012-07-12″,”2012-07-13”); ?>