Professional Documents
Culture Documents
Question: 1
Write code for given program.
Where variable array_points denotes earned points and variable prize_to_give denotes
price as per rank.
You have to find out through $array_points(Max points will be rank 1), if points are
equal then add both rank amount and distribute equally.
Example: Points – 100. (Rank will be 1 and prize amount will be 10,000)
Points – 99. (Rank will be 2 and prize amount will be 5000)
Points – 98 (Rank will be 3 for four persons and prize amount will be
4000+3000+2500+2000= 11500/4 = 2875 for all four as rank 3)
Next Rank will be 7 with 97 Points and prize will be 1800 and so on…
Question: 2
Write code for sorting an array without using php function.
$array=array('2','4','8','5','1','7','6','9','10','3');
Question 3
Write a program in PHP to print Fibonacci series . 0, 1, 1, 2, 3, 5, 8, 13, 21, 34
Question 4
Question 5
23
456
7 8 9 10
8. How to add 301 redirects in PHP?
header("HTTP/1.1 301 Moved Permanently");
header("Location: /option-a");
exit();