Jump to content

To find the number


sandy1028

Recommended Posts

How to find the large number when read from the text file.

 

In the file the $text_line[2] is the numerical values.

How to find the largest number

 

When I print the $text_line[2]

output is 32  23  23  34  23  56  23  222  123  67

 

To sort as array and find the maximum value this is not the array

 

Any help regarding this to find the large number

 

Link to comment
https://forums.phpfreaks.com/topic/61673-to-find-the-number/#findComment-307011
Share on other sites

as what u said earlier ... it seems $text_line[2] is a string of 32  23  23  34  23  56  23  222  123  67 ........ is it ....

so make it a array

like

$aTest = explode(' ',  $text_line[2]);

 

// to get max value

  max($aTest);

 

// to get average ...

  array_sum($aTest)/count($aTest);

 

hope this is wht u want ......

Link to comment
https://forums.phpfreaks.com/topic/61673-to-find-the-number/#findComment-307013
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.