Re: [PHP] RE: Reliable PHP web hosts

2001-08-13 Thread Jan Wilson

* Dan Pierce <[EMAIL PROTECTED]> [010813 09:24]:
> Does anyone have any experience with www.linuxwebhost.com or www.addr.com?

I have been using linuxwebhost for most of my websites during the past
year.  I am generally satisfied, though I have been waiting for a
reply from tech support on some questions I had about PHP support.  It
could be that they don't really know  ;-)

-- 
Jan Wilson, SysAdmin _/*];  [EMAIL PROTECTED]
Corozal Junior College   |  |:'  corozal.com corozal.bz
Corozal Town, Belize |  /'  chetumal.com & linux.bz
Reg. Linux user #151611  |_/   Network, SQL, Perl, HTML


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] age

2001-08-05 Thread Jan Wilson

* Jon Yaggie <[EMAIL PROTECTED]> [010805 16:35]:
> does any one know where i can get a script that will convert a
> birthdate in to an age.  i have one half written however i have
> incounter difficulties with dealing with leap years.  perhaps soem
> one would know the solution  . ..  or just a premade script is fine

This is one of those problems that sounds easy ... until you get into
it.  It is leap years that make it messy.  Try this ... it worked on
all the dates I threw at it, and has options for whether you want just
the year or a fraction, and the fraction can be decimal or days:

function age($birthdate) {
// $birthdate can be most any format
$bornUnix = strtotime($birthdate);
$born = getdate($bornUnix);
$todayUnix = time();
$today = getdate();
$last = array('year' => $today['year'], 'mon' => $born['mon'], 
'mday'=>$born['mday']);
$next = $last;
if ($today['mon'] < $born['mon']) {
// before birthday
$last['year'] -= 1;
} elseif ($today['mon'] > $born['mon']) {
// after birth month
$next['year'] += 1;
} else {
// in birth month
if ($today['mday'] < $born['mday']) {
// before birthday
$last['year'] -= 1;
} elseif ($today['mday'] > $born['mday']) {
// after birthday
$next['year'] += 1;
} else {
// happy birthday
$next['year'] += 1;
}
}
$age = $last['year'] - $born['year'];
// set $yearFraction to TRUE if you want fractional days
$yearFraction = TRUE;
if ($yearFraction) {
// set $yearDecimals to number of decimals desired
$yearDecimals = 3;
$lastUnix = mktime(0,0,0,$last['mon'],$last['mday'],$last['year']);
$nextUnix = mktime(0,0,0,$next['mon'],$next['mday'],$next['year']);
$daysThisYear = ($nextUnix-$lastUnix)/(24*60*60);
$daysSinceLast = ($todayUnix-$lastUnix)/(24*60*60);
if ($yearDecimals > 0) {
// give decimal fraction
$age += $daysSinceLast/$daysThisYear;
$age = number_format($age,$yearDecimals);
} else {
// give actual fraction
$age .= " " . number_format($daysSinceLast,0) . "/" . 
number_format($daysThisYear,0);
}
}
return $age;
}

-- 
Jan Wilson, SysAdmin _/*];  [EMAIL PROTECTED]
Corozal Junior College   |  |:'  corozal.com corozal.bz
Corozal Town, Belize |  /'  chetumal.com & linux.bz
Reg. Linux user #151611  |_/   Network, SQL, Perl, HTML


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] foreach and multiple arrays

2001-07-29 Thread Jan Wilson

* Chris Aitken <[EMAIL PROTECTED]> [010729 19:44]:
> Something ive been working on and not having much success is this. I am 
> writing a function, and I want to be able to feed it the following -
> 
> function_name (
>  array("Apple","Red","10","20"),
>  array("Banana","Yellow","10","20")
>  );
> 
> now, basically what I want to be able to do is, take each array andlist 
> each entry in the array as a variable.. eg..
> 
> (first loop run)
> $title="Apple";
> $value="Red";
> $size1="10";
> $size2="20";
> 
> (first loop run)
> $title="Banana";
> $value="Yellow";
> $size1="10";
> $size2="20";
> 
> etc. The function may have any number of entries (1 onwards) etc. I have 
> played with foreach() and other variants, but I just cant seem to find the 
> right combo of code to get it working.

This seems to work.

$array2d = array(
array("Apple","Red","10","20"),
array("Banana","Yellow","10","20")
);
foreach($array2d as $rowNum => $rowVal) {
print "Row $rowNum:\n";
print "Title is $rowVal[0]\n";
print "Value is $rowVal[1]\n";
print "Size1 is $rowVal[2]\n";
print "Size2 is $rowVal[3]\n";
};

Maybe it will give you a place to start.

-- 
Jan Wilson, SysAdmin _/*];  [EMAIL PROTECTED]
Corozal Junior College   |  |:'  corozal.com corozal.bz
Corozal Town, Belize |  /'  chetumal.com & linux.bz
Reg. Linux user #151611  |_/   Network, SQL, Perl, HTML


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: limiting lines

2001-07-29 Thread Jan Wilson

* dan <[EMAIL PROTECTED]> [010729 11:11]:
> Problem is, the only new lines are at the end of paragraphs, so that, in
> effect, is limiting them to 55 paragraphs.  I'm using a  wrap=physical> which says that it adds a "%0A%0D" (carriage return/line
> feed) at the end of each line.  
> 
> Anyone know how to convert that to a "\n" ?

I don't understand what you're saying about the new lines and end of
paragraphs.  But if you want to convert CRLF to LF, try:

str_replace("\r\n","\n",$string);

-- 
Jan Wilson, SysAdmin _/*];  [EMAIL PROTECTED]
Corozal Junior College   |  |:'  corozal.com corozal.bz
Corozal Town, Belize |  /'  chetumal.com & linux.bz
Reg. Linux user #151611  |_/   Network, SQL, Perl, HTML


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]