RE: [PHP] Re: Determine variable with the lowest value?

2004-10-18 Thread Paul Fine
Than you very much Matt.

Does what I needed. Now I will have to read up on "as" and the function
"key".



-Original Message-
From: Matt M. [mailto:[EMAIL PROTECTED] 
Sent: October 14, 2004 11:27 AM
To: BOOT
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Determine variable with the lowest value?

On Thu, 14 Oct 2004 10:52:20 -0500, BOOT <[EMAIL PROTECTED]> wrote:
> OK thanks but I guess I didn't explain what I am trying to do properly.
> 
> I need to be able to identify the variable name as well as pick the
variable
> with the lowest value.
> 
> Something like this:
> 
> Whose turn is it to take out the garbage?
> 
> Mike has done it 3 times
> Bob has done it 2 times
> Jane has done it 5 times
> etc...
> 
> Therefore its Bob's turn.


$arr['Mike'] = 3;
$arr['Bob'] = 2;
$arr['Jane'] = 5;

foreach ($arr as $key => $value) {
echo $key.' has done it '.$value.' times';
}
asort($arr);
print 'It is '.key($arr).'\'s turn';

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PHP Linux "locate" to html script?

2004-09-03 Thread Paul Fine
Great thanks... now I just work on a form and a hrefs



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: September 3, 2004 1:49 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] PHP Linux "locate" to html script?

";
echo $items;
echo "";
?>

- Original Message -
From: BOOT <[EMAIL PROTECTED]>
Date: Friday, September 3, 2004 1:46 pm
Subject: [PHP] PHP Linux "locate" to html script?

> Does anyone have a script that can be used to call linux's locate 
> commandand display the results in a browser?
> 
> I don't think it would be that hard and will make an effort today...
> 
> 
> Thanks!
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PHP Linux "locate" to html script?

2004-09-03 Thread Paul Fine
Thanks but that's no good if there are multiple results!


-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
Sent: September 3, 2004 1:40 PM
To: BOOT; [EMAIL PROTECTED]
Subject: RE: [PHP] PHP Linux "locate" to html script?

[snip]
Does anyone have a script that can be used to call linux's locate
command
and display the results in a browser?

I don't think it would be that hard and will make an effort today...
[/snip]

exec("locate foo");

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Formatting phone numbers?

2004-04-16 Thread Paul Fine
Thanks!



-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
Sent: April 16, 2004 7:33 AM
To: BOOT; [EMAIL PROTECTED]
Subject: RE: [PHP] Formatting phone numbers?

[snip]
Thanks for any help, even if you just suggest built in functions to look
at.

I'm looking for a way to take a 7 digit number and put it into xxx-
format.

So basically the logic is to count 3 characters into $number and insert
a
"-" there.
[/snip]

As a telecom we use several methods, but here is a small function which
allows us to keep both formats where needed

function addTNDashes ($oldNumber){
   $newNumber = substr($oldNumber, 0, 3) . "-" . substr($oldNumber, 3,
4);
   
   return $newNumber;
}

$telephone = "8654321";
$newTele = addTNDashes($telephone);
echo $newTele;

output is 865-4321 and we can still use $telephone if we need to. 
[stuff you may not need]
This is a boiled down version of a longer function that counts string
lengths to determine how many dashes might need to be added. Let's say
you have the area code in the number, like 2108765432. Being a ten digit
number with a recognizable area code we can then add a portion to the
function to add the two needed dashes, making the number more readable.
[/stuff]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Session confusion again :( - Thanks!

2004-04-14 Thread Paul Fine
Thanks guys but I have register globals ON so once the session variable is
defined I should be able to address it without specifying $_SESSION ?

-Original Message-
From: Chris W. Parker [mailto:[EMAIL PROTECTED] 
Sent: April 14, 2004 11:48 AM
To: BOOT; [EMAIL PROTECTED]
Subject: RE: [PHP] Session confusion again :( - Thanks!

BOOT 
on Wednesday, April 14, 2004 9:40 AM said:

> What I can't understand is why Test1 shows as nothing, while
> Test2 shows the value I wanted. Thanks a lot!

[snip]

> $_SESSION['element_countp'] = count($p_lnames);
> echo "TEST 1".$element_countp;
> 
> $element_countp = $_SESSION['element_countp'];
> echo "TEST 2".$element_countp;

because in test 1 $element_countp has not been assigned anything yet.

$_SESSION['element_countp'] and $element_countp are *not* the same
variable (it appears that you think they are).

in test 2 you assign the value of $_SESSION['element_countp'] to
$element_countp so that's why test 2 works.


hth,
chris.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php