Location: PHPKode > scripts > The First Year Script > the-first-year-script/firstyearecho.php
<?

$list = file ("../firstyear/customize.csv");
$numberc = '0';
$lines = count($list);

          while ($numberc < $lines)
          {
               $item = "$list[$numberc]";
               $pieces = explode(",", $item);

               // example breakup of fields
               $name = "$pieces[0]";
	       $birthday = "$pieces[1] $pieces[2], $pieces[3]";
	       $sex = "$pieces[4]";

               // do something with the variables....
               $numberc ++;
          }

$list = file ("../firstyear/pictures.csv");
$numberp = '0';
$lines = count($list);

          while ($numberp < $lines)
          {
               $item = "$list[$numberp]";
               $pieces = explode(",", $item);

               // example breakup of fields
               $pic = "$pieces[0]";
               $tn = "$pieces[1]";
               $picdate = "$pieces[2]";

               // do something with the variables....
               $numberp ++;
          }

$list = file ("../firstyear/milestones.csv");
$numberm = '0';
$lines = count($list);

          while ($numberm < $lines)
          {
               $item = "$list[$numberm]";
               $pieces = explode(",", $item);

               // example breakup of fields
               $mile = "$pieces[0]";
               $miledate = "$pieces[1]";

               // do something with the variables....
               $numberm ++;
          }

$now = strtotime ("now");
echo "$now is now<br>";
$then = strtotime ("$birthday");
echo "$birthday is birthday<br>";
echo "$then is then<br>";
$difference = $now - $then ;
echo "$difference is $now - $then<br>";
$days = intval($difference/86400);
echo "$days is total days old<br>";
$num = $difference/86400;
echo "$num is $difference divided by 86400<br>";
$num1 = $num/365;
echo "$num1 is $num divided by 365<br>";
$years = intval($num1);
echo "$years is years<br>";
$temp1 = $difference/86400 - $years*365;
echo "$temp1 is $difference divided by 86400 - $years times 365<br>";
$num2 = $temp1/30;
echo "num2 is $temp1 divided by 30<br>";
$months = intval($num2);
echo "$months is months<br>";
$temp2 = $difference/86400 - ($years*365) - ($months*30);
echo "$temp2 is $difference divided by 86400 - ($years times 365) - ($months times 30)<br>";
$num3 = $temp2/7;
echo "$num3 is $temp2 divided by 7<br>";
$weeks = intval($num3);
echo "$weeks is weeks<br>";
$num3a = $difference/86400 - ($years*365) - ($months*30) - ($weeks*7);
echo "$num3a is $difference divided by 86400 - ($years times 365) - ($months times 30) - ($weeks times 7<br>";
$days2 = intval($num3a);
echo "$days2 is days<br>";
Return current item: The First Year Script