Skip to content

Two mini tasks. The first one - write a function that reads from file, filter numbers only in a line, summarize them and print out in desc order. The second one - SQL query to the DB

Notifications You must be signed in to change notification settings

vsosevic/freshdesign

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test #1:

PHP 5.3-5.6

Implement reading from file and print out info like in an example.


Your function must do:
 - Read from file
 - Split data by rows into an array
 - Filter the array in such a way that only rows containing only numbers remain in it
 - Summarize the numbers in each line
 - Sort the received amounts in descending order
 - Return the result

Code example:
 # Path to the file
 $file = __DIR__ . '/datalist.txt';
 # Passing the data to the function that returns the result
 $result = getResult( $file );
 # Printing result
 echo '<pre>';
 var_export( $result );

 function getResult ( $file )
 {
     # @TODO Your code...
 }

Output example:
 array (
   82 => 16396,
   19 => 16169,
   71 => 15864,
   73 => 15224,
   81 => 14244
   ...

About

Two mini tasks. The first one - write a function that reads from file, filter numbers only in a line, summarize them and print out in desc order. The second one - SQL query to the DB

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages