Highest numerical value of an array

Let's say that we have a file with the following strings:
100
3
876
55
When I open the file for reading I would like just to get the highest value. Any one knows how to do this in Kix.
kt2003Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Loganathan NatarajanLAMP DeveloperCommented:
i think this will work,

<?php

echo max(1, 3, 5, 6, 7);  // 7

echo max(array(2, 4, 5)); // 5

?>

just take a look at

http://in2.php.net/max

NOTE: Make sure when you read the values ... convert as ARRAY.. then pass to this function
0
Oddsen84Commented:
"Let's say that we have a file with the following strings:
100
3
876
55
When I open the file for reading I would like just to get the highest value. Any one knows how to do this in Kix."


<?php
$array_result = max($array_name);
?>

Open in new window

0
kt2003Author Commented:
Let me try.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

dr_dedoCommented:
u could use \r instead of \n if it doesn't work for u
$data = file_get_contents('c:\new.txt');
$data = explode("\n",$data);
echo max($data);

Open in new window

0
kt2003Author Commented:
Now. It doesn't work.
Let's say we have in Kix's code something like:

if open(1, $FilePath,2) =0
   $line = READLINE(1)
       WHILE @ ERROR = 0
         ?$line
       $line = READLINE(1)
    loop
endif

I just want $line to give the highest value.
0
dr_dedoCommented:
don't know about kixtart, but if you know it, then need to read the whole file, line by line, and save each line as an element in an array. if there is a max function in kixtart then use it, else, create your own
0
kt2003Author Commented:
Thank you.
0
kt2003Author Commented:
Come on gurus. Any other ideas are welcome.
0
Oddsen84Commented:
You are running PHP??? In case what version???
0
kt2003Author Commented:
No i am running any version of PHP.
0
dr_dedoCommented:
if you are asking for syntax, then you are in the worng area, i see you are posting to php and VB, your desired language is none of them.
if you are asking for ideas, i guess i gave you one.
if you don't know kixtart, then switch to something else as php or even asp. i dont see many using kixtart
0
Loganathan NatarajanLAMP DeveloperCommented:
better you post it in VB section..if u don't want the solution in php
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kt2003Author Commented:
Thank you I will.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.