fork(3) download
  1. <?php
  2. $count = 0;
  3. $input = fopen('php://stdin', "r");
  4. $output = fopen('php://stdout',"w");
  5.  
  6. $line1 = trim(fgets($input));
  7. $test_cases = $line1[0];
  8. $arr = array();
  9.  
  10. while($count < $test_cases){
  11. $val = trim(fgets($input));
  12. array_push($arr, $val);
  13. $count++;
  14. }
  15.  
  16. sort($arr);
  17.  
  18. foreach($arr as $val) {
  19. echo $val . "\n";
  20. }
  21. ?>
Success #stdin #stdout #stderr 0.01s 20520KB
stdin
 
5
5
4
3
2
1
stdout
Standard output is empty
stderr
PHP Notice:  Uninitialized string offset: 0 in /home/DhWphC/prog.php on line 7